equal
deleted
inserted
replaced
71 * optimized octree |
71 * optimized octree |
72 */ |
72 */ |
73 class Octree: public Container |
73 class Octree: public Container |
74 { |
74 { |
75 OctreeNode *root; |
75 OctreeNode *root; |
|
76 const int max_depth; |
76 bool built; |
77 bool built; |
77 const int max_depth; |
|
78 public: |
78 public: |
79 Octree() : Container(), root(NULL), built(false), max_depth(10) {}; |
79 Octree() : Container(), root(NULL), max_depth(10), built(false) {}; |
80 Octree(int maxdepth) : Container(), root(NULL), built(false), max_depth(maxdepth) {}; |
80 Octree(int maxdepth) : Container(), root(NULL), max_depth(maxdepth), built(false) {}; |
81 ~Octree() { if (root) delete root; }; |
81 ~Octree() { if (root) delete root; }; |
82 void addShape(Shape* aShape) { Container::addShape(aShape); built = false; }; |
82 void addShape(Shape* aShape) { Container::addShape(aShape); built = false; }; |
83 Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, |
83 Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, |
84 Float &nearest_distance); |
84 Float &nearest_distance); |
85 void optimize() { build(); }; |
85 void optimize() { build(); }; |