dungeon_crawler
annotate prototype/src/mesh.h @ 53:1ea56011c1ff
stuff + streaming start
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 19 Sep 2012 01:08:41 +0300 |
parents | e5567ddbf2ef |
children |
rev | line source |
---|---|
nuclear@2 | 1 #ifndef MESH_H_ |
nuclear@2 | 2 #define MESH_H_ |
nuclear@2 | 3 |
nuclear@2 | 4 #include <string> |
nuclear@7 | 5 #include <assimp/scene.h> |
nuclear@7 | 6 #include "vmath.h" |
nuclear@11 | 7 #include "material.h" |
nuclear@2 | 8 |
nuclear@2 | 9 enum { |
nuclear@2 | 10 MESH_ATTR_VERTEX, |
nuclear@2 | 11 MESH_ATTR_NORMAL, |
nuclear@2 | 12 MESH_ATTR_TANGENT, |
nuclear@2 | 13 MESH_ATTR_TEXCOORD, |
nuclear@2 | 14 |
nuclear@2 | 15 NUM_MESH_ATTR |
nuclear@2 | 16 }; |
nuclear@2 | 17 |
nuclear@2 | 18 |
nuclear@2 | 19 class Mesh { |
nuclear@2 | 20 private: |
nuclear@2 | 21 std::string name; |
nuclear@2 | 22 |
nuclear@2 | 23 unsigned int nverts, nfaces; |
nuclear@2 | 24 |
nuclear@2 | 25 unsigned int vbo[NUM_MESH_ATTR]; |
nuclear@2 | 26 unsigned int ibo; |
nuclear@2 | 27 |
nuclear@2 | 28 int tang_loc; |
nuclear@2 | 29 |
nuclear@11 | 30 Material mat; |
nuclear@7 | 31 Matrix4x4 xform; |
nuclear@7 | 32 |
nuclear@21 | 33 Vector3 bsph_center; |
nuclear@21 | 34 float bsph_rad; |
nuclear@21 | 35 bool bsph_valid; |
nuclear@21 | 36 |
nuclear@21 | 37 void calc_bsph(); |
nuclear@21 | 38 |
nuclear@2 | 39 public: |
nuclear@2 | 40 Mesh(); |
nuclear@2 | 41 ~Mesh(); |
nuclear@2 | 42 |
nuclear@7 | 43 void set_name(const char *name); |
nuclear@4 | 44 const char *get_name() const; |
nuclear@4 | 45 |
nuclear@2 | 46 bool create(const aiScene *scn, aiMesh *aim); |
nuclear@2 | 47 void destroy(); |
nuclear@2 | 48 |
nuclear@7 | 49 void set_xform(const Matrix4x4 &mat); |
nuclear@7 | 50 const Matrix4x4 &get_xform() const; |
nuclear@7 | 51 |
nuclear@11 | 52 void set_material(const Material &mat); |
nuclear@11 | 53 const Material &get_material() const; |
nuclear@11 | 54 |
nuclear@2 | 55 void set_attrib_location(int attr, int loc); |
nuclear@2 | 56 int get_attrib_location(int attr) const; |
nuclear@2 | 57 |
nuclear@2 | 58 void draw() const; |
nuclear@21 | 59 |
nuclear@21 | 60 const Vector3 &get_bsph_center() const; |
nuclear@21 | 61 float get_bsph_radius() const; |
nuclear@2 | 62 }; |
nuclear@2 | 63 |
nuclear@2 | 64 #endif // MESH_H_ |