dungeon_crawler

view prototype/src/mesh.h @ 75:b05ab29cd17d

color grading done
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 22 Oct 2012 03:55:00 +0300
parents e5567ddbf2ef
children
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 Vector3 bsph_center;
34 float bsph_rad;
35 bool bsph_valid;
37 void calc_bsph();
39 public:
40 Mesh();
41 ~Mesh();
43 void set_name(const char *name);
44 const char *get_name() const;
46 bool create(const aiScene *scn, aiMesh *aim);
47 void destroy();
49 void set_xform(const Matrix4x4 &mat);
50 const Matrix4x4 &get_xform() const;
52 void set_material(const Material &mat);
53 const Material &get_material() const;
55 void set_attrib_location(int attr, int loc);
56 int get_attrib_location(int attr) const;
58 void draw() const;
60 const Vector3 &get_bsph_center() const;
61 float get_bsph_radius() const;
62 };
64 #endif // MESH_H_