clray
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/mesh.h Tue Jul 20 20:02:41 2010 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +#ifndef MESH_H_ 1.5 +#define MESH_H_ 1.6 + 1.7 +#include <vector> 1.8 + 1.9 +struct Vertex { 1.10 + float pos[3]; 1.11 + float normal[3]; 1.12 + float tex[2]; 1.13 +}; 1.14 + 1.15 +struct Face { 1.16 + Vertex v[3]; 1.17 + float normal[3]; 1.18 + int matid; 1.19 +}; 1.20 + 1.21 +struct Material { 1.22 + float kd[3], ks[3]; 1.23 + float kr, kt; 1.24 + float spow; 1.25 +}; 1.26 + 1.27 +struct Mesh { 1.28 + std::vector<Face> faces; 1.29 + int matid; 1.30 +}; 1.31 + 1.32 +class Scene { 1.33 +public: 1.34 + std::vector<Mesh*> meshes; 1.35 + std::vector<Material> matlib; 1.36 + 1.37 + bool load(const char *fname); 1.38 + bool load(FILE *fp); 1.39 +}; 1.40 + 1.41 +#endif /* MESH_H_ */