annotate src/mesh.h @ 12:2656099aff12
added copyright notices and license
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Fri, 18 Jul 2014 07:04:21 +0300 |
parents |
3d3656360a82 |
children |
|
rev |
line source |
nuclear@12
|
1 /*
|
nuclear@12
|
2 eqemu - electronic queue system emulator
|
nuclear@12
|
3 Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org>,
|
nuclear@12
|
4 Eleni-Maria Stea <eleni@mutantstargoat.com>
|
nuclear@12
|
5
|
nuclear@12
|
6 This program is free software: you can redistribute it and/or modify
|
nuclear@12
|
7 it under the terms of the GNU General Public License as published by
|
nuclear@12
|
8 the Free Software Foundation, either version 3 of the License, or
|
nuclear@12
|
9 (at your option) any later version.
|
nuclear@12
|
10
|
nuclear@12
|
11 This program is distributed in the hope that it will be useful,
|
nuclear@12
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
nuclear@12
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
nuclear@12
|
14 GNU General Public License for more details.
|
nuclear@12
|
15
|
nuclear@12
|
16 You should have received a copy of the GNU General Public License
|
nuclear@12
|
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
nuclear@12
|
18 */
|
nuclear@3
|
19 #ifndef MESH_H_
|
nuclear@3
|
20 #define MESH_H_
|
nuclear@3
|
21
|
nuclear@4
|
22 #include "bvol.h"
|
nuclear@4
|
23
|
nuclear@3
|
24 enum {
|
nuclear@3
|
25 MESH_ATTR_VERTEX,
|
nuclear@3
|
26 MESH_ATTR_NORMAL,
|
nuclear@3
|
27 MESH_ATTR_TEXCOORD,
|
nuclear@3
|
28
|
nuclear@3
|
29 NUM_MESH_ATTRIBS
|
nuclear@3
|
30 };
|
nuclear@3
|
31
|
nuclear@3
|
32 class Mesh {
|
nuclear@3
|
33 private:
|
nuclear@3
|
34 float *attr[NUM_MESH_ATTRIBS];
|
nuclear@3
|
35 int vcount;
|
nuclear@3
|
36 unsigned int vbo[NUM_MESH_ATTRIBS];
|
nuclear@3
|
37 int attr_size[NUM_MESH_ATTRIBS];
|
nuclear@3
|
38
|
nuclear@3
|
39 mutable unsigned int buf_valid; /* bitmask */
|
nuclear@3
|
40 void update_buffers() const;
|
nuclear@3
|
41
|
nuclear@4
|
42 mutable BSphere bsph;
|
nuclear@4
|
43 mutable bool bsph_valid;
|
nuclear@4
|
44 void calc_bsph() const;
|
nuclear@4
|
45
|
nuclear@3
|
46 public:
|
nuclear@3
|
47 Mesh();
|
nuclear@3
|
48 ~Mesh();
|
nuclear@3
|
49
|
nuclear@3
|
50 float *set_attrib(int aidx, int count, int elemsz, float *data = 0);
|
nuclear@3
|
51 float *get_attrib(int aidx);
|
nuclear@3
|
52 const float *get_attrib(int aidx) const;
|
nuclear@3
|
53
|
nuclear@3
|
54 void draw() const;
|
nuclear@4
|
55
|
nuclear@4
|
56 BSphere &get_bounds();
|
nuclear@4
|
57 const BSphere &get_bounds() const;
|
nuclear@3
|
58 };
|
nuclear@3
|
59
|
nuclear@3
|
60 #endif // MESH_H_
|