src/kdtree.h
branchpyrit
changeset 16 20bceb605f48
parent 15 a0a3e334744f
child 21 79b516a3803d
--- a/src/kdtree.h	Sun Nov 25 17:58:29 2007 +0100
+++ b/src/kdtree.h	Sun Nov 25 21:47:10 2007 +0100
@@ -39,6 +39,7 @@
 	};
 
 	KdNode() : axis(3) { shapes = new ShapeList(); };
+	~KdNode();
 
 	void setAxis(short aAxis) { axis = aAxis; };
 	short getAxis() { return axis; };
@@ -62,7 +63,8 @@
 	KdNode *root;
 	bool built;
 public:
-	KdTree() : Container(), built(false) {};
+	KdTree() : Container(), root(NULL), built(false) {};
+	~KdTree() { if (root) delete root; };
 	void addShape(Shape* aShape) { Container::addShape(aShape); built = false; };
 	Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray,
 		float &nearest_distance);