clray

view src/mesh.h @ 6:b06518bb16e9

adding polygon meshes and obj loading
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 20 Jul 2010 20:02:41 +0100
parents
children a09622aaa043
line source
1 #ifndef MESH_H_
2 #define MESH_H_
4 #include <vector>
6 struct Vertex {
7 float pos[3];
8 float normal[3];
9 float tex[2];
10 };
12 struct Face {
13 Vertex v[3];
14 float normal[3];
15 int matid;
16 };
18 struct Material {
19 float kd[3], ks[3];
20 float kr, kt;
21 float spow;
22 };
24 struct Mesh {
25 std::vector<Face> faces;
26 int matid;
27 };
29 class Scene {
30 public:
31 std::vector<Mesh*> meshes;
32 std::vector<Material> matlib;
34 bool load(const char *fname);
35 bool load(FILE *fp);
36 };
38 #endif /* MESH_H_ */