clray

annotate src/mesh.h @ 15:754faf15ba36

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