--- a/include/octree.h Fri May 02 13:27:47 2008 +0200
+++ b/include/octree.h Mon May 05 15:31:14 2008 +0200
@@ -61,10 +61,10 @@
OctreeNode *getChild(const int num) { assert(!isLeaf()); return children + num; };
void addShape(Shape* aShape) { getShapes()->push_back(aShape); };
- ShapeList *getShapes() { return (ShapeList*)((off_t)shapes & ~(off_t)1); };
+ ShapeList *getShapes() { return (ShapeList*)((size_t)shapes & ~(size_t)1); };
void setShapes(ShapeList *const ashapes) { shapes = ashapes; assert(!isLeaf()); setLeaf(); };
- void subdivide(BBox bbox, int maxdepth);
+ void subdivide(const BBox &bbox, int maxdepth);
};
/**
@@ -74,9 +74,10 @@
{
OctreeNode *root;
bool built;
- int max_depth;
+ const int max_depth;
public:
Octree() : Container(), root(NULL), built(false), max_depth(10) {};
+ Octree(int maxdepth) : Container(), root(NULL), built(false), max_depth(maxdepth) {};
~Octree() { if (root) delete root; };
void addShape(Shape* aShape) { Container::addShape(aShape); built = false; };
Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray,
@@ -85,7 +86,6 @@
void build();
void save(ostream &str, OctreeNode *node = NULL) {};
void load(istream &str, OctreeNode *node = NULL) {};
- void setMaxDepth(int md) { max_depth = md; };
};
#endif