dungeon_crawler

view prototype/src/mesh.h @ 11:e5567ddbf2ef

- Texture set (texture manager) - materials
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 19 Aug 2012 03:11:36 +0300
parents 8fb37db44fd8
children 0588f8a1a351
line source
1 #ifndef MESH_H_
2 #define MESH_H_
4 #include <string>
5 #include <assimp/scene.h>
6 #include "vmath.h"
7 #include "material.h"
9 enum {
10 MESH_ATTR_VERTEX,
11 MESH_ATTR_NORMAL,
12 MESH_ATTR_TANGENT,
13 MESH_ATTR_TEXCOORD,
15 NUM_MESH_ATTR
16 };
19 class Mesh {
20 private:
21 std::string name;
23 unsigned int nverts, nfaces;
25 unsigned int vbo[NUM_MESH_ATTR];
26 unsigned int ibo;
28 int tang_loc;
30 Material mat;
31 Matrix4x4 xform;
33 public:
34 Mesh();
35 ~Mesh();
37 void set_name(const char *name);
38 const char *get_name() const;
40 bool create(const aiScene *scn, aiMesh *aim);
41 void destroy();
43 void set_xform(const Matrix4x4 &mat);
44 const Matrix4x4 &get_xform() const;
46 void set_material(const Material &mat);
47 const Material &get_material() const;
49 void set_attrib_location(int attr, int loc);
50 int get_attrib_location(int attr) const;
52 void draw() const;
53 };
55 #endif // MESH_H_