*******************************************************************************/
-#include "Camera.hh"
+#include "Frustum.hh"
#include "Log.hh"
#include "Octree.hh"
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)
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)
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)
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)
}
}
-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;
}
else // collision == Frustum::INTERSECT
{
- node->drawIfVisible(alpha, cam);
+ node->drawIfVisible(alpha, frustum);
}
if (tree_.children(node) > 0)
OctreeNodeP child = tree_.child(node, i);
ASSERT(child.valid() && "expected valid child node");
- drawIfVisible(alpha, cam, child);
+ drawIfVisible(alpha, frustum, child);
}
}
}