--- a/include/kdtree.h Thu May 08 09:21:25 2008 +0200
+++ b/include/kdtree.h Sat May 10 14:29:37 2008 +0200
@@ -69,7 +69,7 @@
KdNode* getRightChild() const { return (KdNode*)(((size_t)children & ~3) + 16); };
ShapeList* getShapes() const { return (ShapeList*)((size_t)shapes & ~3); };
- void addShape(Shape* aShape) { getShapes()->push_back(aShape); };
+ void addShape(const Shape* aShape) { getShapes()->push_back(aShape); };
};
/**
@@ -88,19 +88,19 @@
KdTree(): Container(), mempool(64), root(NULL), max_depth(32), built(false) {};
KdTree(int maxdepth): Container(), mempool(64), root(NULL), max_depth(maxdepth), 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,
+ void addShape(const Shape* aShape) { Container::addShape(aShape); built = false; };
+ const Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray,
Float &nearest_distance);
#ifndef NO_SIMD
void packet_intersection(const Shape* const* origin_shapes, const RayPacket &rays,
- Float *nearest_distances, Shape **nearest_shapes);
+ Float *nearest_distances, const Shape **nearest_shapes);
#endif
void optimize() { build(); };
void build();
bool isBuilt() const { return built; };
KdNode *getRootNode() const { return root; };
- ostream & dump(ostream &st);
+ ostream & dump(ostream &st) const;
istream & load(istream &st, Material *mat);
};