+ void draw(Scalar alpha) const
+ {
+ typename std::list<InsertableP>::const_iterator it;
+
+ for (it = objects.begin(); it != objects.end(); ++it)
+ {
+ (*it)->draw(alpha);
+ }
+
+ if (!objects.empty())
+ aabb.draw(); // temporary
+ }
+
+ void drawIfVisible(Scalar alpha, const Frustum& frustum) const
+ {
+ typename std::list<InsertableP>::const_iterator it;
+
+ for (it = objects.begin(); it != objects.end(); ++it)
+ {
+ (*it)->drawIfVisible(alpha, frustum);
+ }
+
+ if (!objects.empty())
+ {
+ //aabb.draw();
+ //sphere.draw();
+ }
+ }
+
+
+ bool isVisible(const Frustum& frustum) const
+ {
+ if (sphere.isVisible(frustum))
+ {
+ return aabb.isVisible(frustum);
+ }
+
+ return false;
+ }
+ };
+
+
+public:
+
+ typedef boost::shared_ptr<Octree> Ptr;
+ typedef typename stlplus::ntree<Node>::iterator NodeP;
+
+private:
+
+
+ NodeP insert(InsertableP entity, NodeP node)
+ {
+ ASSERT(node.valid() && "invalid node passed");
+ ASSERT(entity && "null entity passed");
+
+ if (entity->isInsideAabb(node->aabb))
+ {
+ return insert_recurse(entity, node);
+ }
+ else
+ {
+ node->objects.push_back(entity);
+ return node;
+ }