dungeon_crawler
diff prototype/src/mesh.h @ 2:1f61f2a02832
added mesh class
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 09 Aug 2012 06:20:27 +0300 |
parents | |
children | 158de53b4e18 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/prototype/src/mesh.h Thu Aug 09 06:20:27 2012 +0300 1.3 @@ -0,0 +1,42 @@ 1.4 +#ifndef MESH_H_ 1.5 +#define MESH_H_ 1.6 + 1.7 +#include <string> 1.8 +#include <assimp/assimp.h> 1.9 +#include <assimp/aiScene.h> 1.10 + 1.11 +enum { 1.12 + MESH_ATTR_VERTEX, 1.13 + MESH_ATTR_NORMAL, 1.14 + MESH_ATTR_TANGENT, 1.15 + MESH_ATTR_TEXCOORD, 1.16 + 1.17 + NUM_MESH_ATTR 1.18 +}; 1.19 + 1.20 + 1.21 +class Mesh { 1.22 +private: 1.23 + std::string name; 1.24 + 1.25 + unsigned int nverts, nfaces; 1.26 + 1.27 + unsigned int vbo[NUM_MESH_ATTR]; 1.28 + unsigned int ibo; 1.29 + 1.30 + int tang_loc; 1.31 + 1.32 +public: 1.33 + Mesh(); 1.34 + ~Mesh(); 1.35 + 1.36 + bool create(const aiScene *scn, aiMesh *aim); 1.37 + void destroy(); 1.38 + 1.39 + void set_attrib_location(int attr, int loc); 1.40 + int get_attrib_location(int attr) const; 1.41 + 1.42 + void draw() const; 1.43 +}; 1.44 + 1.45 +#endif // MESH_H_