clray

diff src/scene.h @ 24:13091c00d7ca

- moved create_face_buffer to Scene::get_face_buffer and did a few reorganizations. - starting work on the kdtree creation
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 Aug 2010 03:02:52 +0100
parents 51f115e337c2
children 58642a8316b7
line diff
     1.1 --- a/src/scene.h	Fri Aug 13 18:20:45 2010 +0100
     1.2 +++ b/src/scene.h	Sat Aug 14 03:02:52 2010 +0100
     1.3 @@ -3,6 +3,7 @@
     1.4  
     1.5  #include <stdio.h>
     1.6  #include <vector>
     1.7 +#include <list>
     1.8  
     1.9  struct Vertex {
    1.10  	float pos[4];
    1.11 @@ -47,13 +48,31 @@
    1.12  struct KDNode {
    1.13  	int axis;
    1.14  	float pt;
    1.15 +
    1.16 +	KDNode *left, *right;
    1.17 +	std::list<Face*> faces;
    1.18  };
    1.19  
    1.20 +struct KDNodeGPU {
    1.21 +	int axis;
    1.22 +	float pt;
    1.23 +};
    1.24 +
    1.25 +
    1.26  class Scene {
    1.27 +private:
    1.28 +	mutable Face *facebuf;
    1.29 +	mutable int num_faces;
    1.30 +
    1.31  public:
    1.32  	std::vector<Mesh*> meshes;
    1.33  	std::vector<Material> matlib;
    1.34 -	std::vector<KDNode> kdtree;
    1.35 +
    1.36 +	KDNode *kdtree;
    1.37 +	std::vector<KDNode> kdtree_gpu;
    1.38 +
    1.39 +	Scene();
    1.40 +	~Scene();
    1.41  
    1.42  	bool add_mesh(Mesh *m);
    1.43  	int get_num_meshes() const;
    1.44 @@ -66,6 +85,7 @@
    1.45  	bool load(const char *fname);
    1.46  	bool load(FILE *fp);
    1.47  
    1.48 +	const Face *get_face_buffer() const;
    1.49  	void build_kdtree();
    1.50  };
    1.51