clray
annotate 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 |
rev | line source |
---|---|
nuclear@6 | 1 #ifndef MESH_H_ |
nuclear@6 | 2 #define MESH_H_ |
nuclear@6 | 3 |
nuclear@6 | 4 #include <vector> |
nuclear@6 | 5 |
nuclear@6 | 6 struct Vertex { |
nuclear@6 | 7 float pos[3]; |
nuclear@6 | 8 float normal[3]; |
nuclear@6 | 9 float tex[2]; |
nuclear@6 | 10 }; |
nuclear@6 | 11 |
nuclear@6 | 12 struct Face { |
nuclear@6 | 13 Vertex v[3]; |
nuclear@6 | 14 float normal[3]; |
nuclear@6 | 15 int matid; |
nuclear@6 | 16 }; |
nuclear@6 | 17 |
nuclear@6 | 18 struct Material { |
nuclear@6 | 19 float kd[3], ks[3]; |
nuclear@6 | 20 float kr, kt; |
nuclear@6 | 21 float spow; |
nuclear@6 | 22 }; |
nuclear@6 | 23 |
nuclear@6 | 24 struct Mesh { |
nuclear@6 | 25 std::vector<Face> faces; |
nuclear@6 | 26 int matid; |
nuclear@6 | 27 }; |
nuclear@6 | 28 |
nuclear@6 | 29 class Scene { |
nuclear@6 | 30 public: |
nuclear@6 | 31 std::vector<Mesh*> meshes; |
nuclear@6 | 32 std::vector<Material> matlib; |
nuclear@6 | 33 |
nuclear@6 | 34 bool load(const char *fname); |
nuclear@6 | 35 bool load(FILE *fp); |
nuclear@6 | 36 }; |
nuclear@6 | 37 |
nuclear@6 | 38 #endif /* MESH_H_ */ |