src/raytracer.h
branchpyrit
changeset 20 f22952603f29
parent 19 4e0955fca797
child 21 79b516a3803d
--- a/src/raytracer.h	Mon Nov 26 23:12:40 2007 +0100
+++ b/src/raytracer.h	Thu Nov 29 18:30:16 2007 +0100
@@ -10,6 +10,7 @@
 
 #include <vector>
 
+#include "common.h"
 #include "kdtree.h"
 #include "scene.h"
 
@@ -38,14 +39,15 @@
 
 	Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal);
 public:
-	Raytracer(): camera(NULL), lights(), bg_colour(0.0, 0.0, 0.0),
-		ao_samples(0), num_threads(4) { top = new KdTree(); };
-	~Raytracer() { delete top; };
-	float *render(int w, int h);
+	Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0.0, 0.0, 0.0),
+		ao_samples(0), num_threads(4) {};
+	void render(int w, int h, float *buffer);
 	Colour raytrace(Ray &ray, int depth, Shape *origin_shape);
 	void addshape(Shape *shape) { top->addShape(shape); };
 	void addlight(Light *light);
 	void setCamera(Camera *cam) { camera = cam; };
+	void setTop(Container *atop) { top = atop; };
+	Container *getTop() { return top; };
 
 	void ambientocclusion(int samples, float distance, float angle);
 	void setThreads(int num) { num_threads = num; };