]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Octree.cc
improved new vorbisfile compatibility
[chaz/yoink] / src / Moof / Octree.cc
index bd1b410a6faa17cbc837df55527646b54c5232fb..062788daa1f0d0378460c09cfd4b99eff4d924ca 100644 (file)
@@ -26,7 +26,7 @@
 
 *******************************************************************************/
 
-#include "Camera.hh"
+#include "Frustum.hh"
 #include "Log.hh"
 #include "Octree.hh"
        
@@ -72,28 +72,28 @@ OctreeNodeP Octree::insert(EntityP entity, OctreeNodeP node)
                goto done;
        }
 
-       halfspace = xy.intersectsSphere(entity->getSphere());
+       halfspace = xy.intersects(entity->getSphere());
        if (halfspace == Plane::INTERSECT)
        {
-               halfspace = xy.intersectsAabb(entity->getAabb());
+               halfspace = xy.intersects(entity->getAabb());
        }
 
        if (halfspace == Plane::POSITIVE)
        {
                Plane xz = node->getAabb().getPlaneXZ();
-               halfspace = xz.intersectsSphere(entity->getSphere());
+               halfspace = xz.intersects(entity->getSphere());
                if (halfspace == Plane::INTERSECT)
                {
-                       halfspace = xz.intersectsAabb(entity->getAabb());
+                       halfspace = xz.intersects(entity->getAabb());
                }
 
                if (halfspace == Plane::POSITIVE)
                {
                        Plane yz = node->getAabb().getPlaneYZ();
-                       halfspace = yz.intersectsSphere(entity->getSphere());
+                       halfspace = yz.intersects(entity->getSphere());
                        if (halfspace == Plane::INTERSECT)
                        {
-                               halfspace = yz.intersectsAabb(entity->getAabb());
+                               halfspace = yz.intersects(entity->getAabb());
                        }
 
                        if (halfspace == Plane::POSITIVE)
@@ -108,10 +108,10 @@ OctreeNodeP Octree::insert(EntityP entity, OctreeNodeP node)
                else if (halfspace == Plane::NEGATIVE)
                {
                        Plane yz = node->getAabb().getPlaneYZ();
-                       halfspace = yz.intersectsSphere(entity->getSphere());
+                       halfspace = yz.intersects(entity->getSphere());
                        if (halfspace == Plane::INTERSECT)
                        {
-                               halfspace = yz.intersectsAabb(entity->getAabb());
+                               halfspace = yz.intersects(entity->getAabb());
                        }
 
                        if (halfspace == Plane::POSITIVE)
@@ -127,19 +127,19 @@ OctreeNodeP Octree::insert(EntityP entity, OctreeNodeP node)
        else if (halfspace == Plane::NEGATIVE)
        {
                Plane xz = node->getAabb().getPlaneXZ();
-               halfspace = xz.intersectsSphere(entity->getSphere());
+               halfspace = xz.intersects(entity->getSphere());
                if (halfspace == Plane::INTERSECT)
                {
-                       halfspace = xz.intersectsAabb(entity->getAabb());
+                       halfspace = xz.intersects(entity->getAabb());
                }
 
                if (halfspace == Plane::POSITIVE)
                {
                        Plane yz = node->getAabb().getPlaneYZ();
-                       halfspace = yz.intersectsSphere(entity->getSphere());
+                       halfspace = yz.intersects(entity->getSphere());
                        if (halfspace == Plane::INTERSECT)
                        {
-                               halfspace = yz.intersectsAabb(entity->getAabb());
+                               halfspace = yz.intersects(entity->getAabb());
                        }
 
                        if (halfspace == Plane::POSITIVE)
@@ -154,10 +154,10 @@ OctreeNodeP Octree::insert(EntityP entity, OctreeNodeP node)
                else if (halfspace == Plane::NEGATIVE)
                {
                        Plane yz = node->getAabb().getPlaneYZ();
-                       halfspace = yz.intersectsSphere(entity->getSphere());
+                       halfspace = yz.intersects(entity->getSphere());
                        if (halfspace == Plane::INTERSECT)
                        {
-                               halfspace = yz.intersectsAabb(entity->getAabb());
+                               halfspace = yz.intersects(entity->getAabb());
                        }
 
                        if (halfspace == Plane::POSITIVE)
@@ -238,17 +238,17 @@ void Octree::draw(Scalar alpha, OctreeNodeP node)
        }
 }
 
-void Octree::drawIfVisible(Scalar alpha, const Camera& cam, OctreeNodeP node)
+void Octree::drawIfVisible(Scalar alpha, const Frustum& frustum, OctreeNodeP node)
 {
        ASSERT(node.valid() && "invalid node passed");
 
        // try to cull by sphere
        Frustum::Collision collision =
-               cam.getFrustum().containsSphere(node->getSphere());
+               frustum.contains(node->getSphere());
        if (collision == Frustum::OUTSIDE) return;
 
        // try to cull by aabb
-       collision = cam.getFrustum().containsAabb(node->getAabb());
+       collision = frustum.contains(node->getAabb());
        if (collision == Frustum::OUTSIDE) return;
 
 
@@ -258,7 +258,7 @@ void Octree::drawIfVisible(Scalar alpha, const Camera& cam, OctreeNodeP node)
        }
        else // collision == Frustum::INTERSECT
        {
-               node->drawIfVisible(alpha, cam);
+               node->drawIfVisible(alpha, frustum);
        }
 
        if (tree_.children(node) > 0)
@@ -280,7 +280,7 @@ void Octree::drawIfVisible(Scalar alpha, const Camera& cam, OctreeNodeP node)
                                OctreeNodeP child = tree_.child(node, i);
                                ASSERT(child.valid() && "expected valid child node");
 
-                               drawIfVisible(alpha, cam, child);
+                               drawIfVisible(alpha, frustum, child);
                        }
                }
        }
This page took 0.026236 seconds and 4 git commands to generate.