+ std::list<EntityP> objects;
+
+ OctreeNode()
+ {
+ aabb_.min = Vector3(-1.0, -1.0, -1.0);
+ aabb_.max = Vector3(1.0, 1.0, 1.0);
+ sphere_.init(Vector3(0.0, 0.0, 0.0), 1.41421);
+ }
+
+ OctreeNode(const Aabb& aabb)
+ {
+ aabb_ = aabb;
+ sphere_.point = aabb.getCenter();
+ sphere_.radius = (aabb.min - sphere_.point).length();
+ }
+
+ void draw(Scalar alpha) const
+ {
+ std::list<EntityP>::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
+ {
+ std::list<EntityP>::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;
+ }
+
+
+ static bool compareZOrder(EntityP a, EntityP b)
+ {
+ return a->getSphere().point[2] < b->getSphere().point[2];
+ }