eqemu

view src/mesh.h @ 3:f9274bebe55e

adding 3d graphics stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Jul 2014 02:35:19 +0300
parents
children 3d3656360a82
line source
1 #ifndef MESH_H_
2 #define MESH_H_
4 enum {
5 MESH_ATTR_VERTEX,
6 MESH_ATTR_NORMAL,
7 MESH_ATTR_TEXCOORD,
9 NUM_MESH_ATTRIBS
10 };
12 class Mesh {
13 private:
14 float *attr[NUM_MESH_ATTRIBS];
15 int vcount;
16 unsigned int vbo[NUM_MESH_ATTRIBS];
17 int attr_size[NUM_MESH_ATTRIBS];
19 mutable unsigned int buf_valid; /* bitmask */
20 void update_buffers() const;
22 public:
23 Mesh();
24 ~Mesh();
26 float *set_attrib(int aidx, int count, int elemsz, float *data = 0);
27 float *get_attrib(int aidx);
28 const float *get_attrib(int aidx) const;
30 void draw() const;
31 };
33 #endif // MESH_H_