dungeon_crawler
annotate prototype/src/mesh.h @ 16:91180ee7b7d9
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 20 Aug 2012 03:40:51 +0300 |
parents | 8fb37db44fd8 |
children | 0588f8a1a351 |
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@2 | 33 public: |
nuclear@2 | 34 Mesh(); |
nuclear@2 | 35 ~Mesh(); |
nuclear@2 | 36 |
nuclear@7 | 37 void set_name(const char *name); |
nuclear@4 | 38 const char *get_name() const; |
nuclear@4 | 39 |
nuclear@2 | 40 bool create(const aiScene *scn, aiMesh *aim); |
nuclear@2 | 41 void destroy(); |
nuclear@2 | 42 |
nuclear@7 | 43 void set_xform(const Matrix4x4 &mat); |
nuclear@7 | 44 const Matrix4x4 &get_xform() const; |
nuclear@7 | 45 |
nuclear@11 | 46 void set_material(const Material &mat); |
nuclear@11 | 47 const Material &get_material() const; |
nuclear@11 | 48 |
nuclear@2 | 49 void set_attrib_location(int attr, int loc); |
nuclear@2 | 50 int get_attrib_location(int attr) const; |
nuclear@2 | 51 |
nuclear@2 | 52 void draw() const; |
nuclear@2 | 53 }; |
nuclear@2 | 54 |
nuclear@2 | 55 #endif // MESH_H_ |