clray

view src/mesh.h @ 15:754faf15ba36

burp
author John Tsiombikas
date Sun, 08 Aug 2010 09:51:45 +0100
parents 29f9330cfa4b
children
line source
1 #ifndef MESH_H_
2 #define MESH_H_
4 #include <vector>
6 struct Vertex {
7 float pos[4];
8 float normal[4];
9 float tex[4];
10 float padding[4];
11 };
13 struct Face {
14 Vertex v[3];
15 float normal[4];
16 int matid;
17 int padding[3];
19 bool operator ==(const Face &f) const;
20 };
22 struct Material {
23 float kd[4], ks[4];
24 float kr, kt;
25 float spow;
26 float padding;
27 };
29 struct Mesh {
30 std::vector<Face> faces;
31 int matid;
32 };
34 class Scene {
35 public:
36 std::vector<Mesh*> meshes;
37 std::vector<Material> matlib;
39 bool add_mesh(Mesh *m);
40 int get_num_meshes() const;
41 int get_num_materials() const;
42 int get_num_faces() const;
44 Material *get_materials();
45 const Material *get_materials() const;
47 bool load(const char *fname);
48 bool load(FILE *fp);
49 };
51 #endif /* MESH_H_ */