eqemu

annotate 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
rev   line source
nuclear@3 1 #ifndef MESH_H_
nuclear@3 2 #define MESH_H_
nuclear@3 3
nuclear@4 4 #include "bvol.h"
nuclear@4 5
nuclear@3 6 enum {
nuclear@3 7 MESH_ATTR_VERTEX,
nuclear@3 8 MESH_ATTR_NORMAL,
nuclear@3 9 MESH_ATTR_TEXCOORD,
nuclear@3 10
nuclear@3 11 NUM_MESH_ATTRIBS
nuclear@3 12 };
nuclear@3 13
nuclear@3 14 class Mesh {
nuclear@3 15 private:
nuclear@3 16 float *attr[NUM_MESH_ATTRIBS];
nuclear@3 17 int vcount;
nuclear@3 18 unsigned int vbo[NUM_MESH_ATTRIBS];
nuclear@3 19 int attr_size[NUM_MESH_ATTRIBS];
nuclear@3 20
nuclear@3 21 mutable unsigned int buf_valid; /* bitmask */
nuclear@3 22 void update_buffers() const;
nuclear@3 23
nuclear@4 24 mutable BSphere bsph;
nuclear@4 25 mutable bool bsph_valid;
nuclear@4 26 void calc_bsph() const;
nuclear@4 27
nuclear@3 28 public:
nuclear@3 29 Mesh();
nuclear@3 30 ~Mesh();
nuclear@3 31
nuclear@3 32 float *set_attrib(int aidx, int count, int elemsz, float *data = 0);
nuclear@3 33 float *get_attrib(int aidx);
nuclear@3 34 const float *get_attrib(int aidx) const;
nuclear@3 35
nuclear@3 36 void draw() const;
nuclear@4 37
nuclear@4 38 BSphere &get_bounds();
nuclear@4 39 const BSphere &get_bounds() const;
nuclear@3 40 };
nuclear@3 41
nuclear@3 42 #endif // MESH_H_