eqemu

view src/mesh.h @ 10:819c7ebb1bec

added libimago to avoid the external dependency
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 18 Jul 2014 05:07:40 +0300
parents f9274bebe55e
children 2656099aff12
line source
1 #ifndef MESH_H_
2 #define MESH_H_
4 #include "bvol.h"
6 enum {
7 MESH_ATTR_VERTEX,
8 MESH_ATTR_NORMAL,
9 MESH_ATTR_TEXCOORD,
11 NUM_MESH_ATTRIBS
12 };
14 class Mesh {
15 private:
16 float *attr[NUM_MESH_ATTRIBS];
17 int vcount;
18 unsigned int vbo[NUM_MESH_ATTRIBS];
19 int attr_size[NUM_MESH_ATTRIBS];
21 mutable unsigned int buf_valid; /* bitmask */
22 void update_buffers() const;
24 mutable BSphere bsph;
25 mutable bool bsph_valid;
26 void calc_bsph() const;
28 public:
29 Mesh();
30 ~Mesh();
32 float *set_attrib(int aidx, int count, int elemsz, float *data = 0);
33 float *get_attrib(int aidx);
34 const float *get_attrib(int aidx) const;
36 void draw() const;
38 BSphere &get_bounds();
39 const BSphere &get_bounds() const;
40 };
42 #endif // MESH_H_