Added head mesh, points/directions for hair that follow the Poisson
[hair] / src / mesh.h
1 #ifndef MESH_H_
2 #define MESH_H_
3
4 #include <stdint.h>
5 #include <vector>
6 #include <gmath/gmath.h>
7
8 #define MESH_ALL (0xffffffff)
9
10 enum {
11         MESH_VERTEX = 1,
12         MESH_NORMAL = 2,
13         MESH_COLOR = 4,
14         MESH_INDEX = 8
15 };
16
17 struct Aabb {
18         Vec3 v0;
19         Vec3 v1;
20 };
21
22 class Mesh {
23 private:
24         unsigned int vbo_vertices;
25         unsigned int vbo_normals;
26         unsigned int vbo_colors;
27         unsigned int ibo;
28
29         int num_vertices;
30         int num_indices;
31
32 public:
33         Mesh();
34         ~Mesh();
35
36         Aabb bbox;
37
38         std::string name;
39         std::vector<uint16_t> indices;
40         std::vector<Vec3> vertices;
41         std::vector<Vec3> normals;
42         std::vector<Vec3> colors;
43
44         void draw() const;
45         void update_vbo(unsigned int which);
46
47         void calc_bbox();
48 };
49
50 std::vector<Mesh*> load_meshes(const char *fname);
51
52 #endif // MESH_H_