I noticed that it's not actually checking the bounding box against the frustum. It's calculating a sphere that encloses the bounding box (center, and halfSize) and doing bounding sphere culling instead.
Here's the code (lines 226-262):
Code: Select all
bool Frustum::isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy) const
{
// Null boxes always invisible
if (bound.isNull()) return false;
// Infinite boxes always visible
if (bound.isInfinite()) return true;
// Make any pending updates to the calculated frustum planes
updateFrustumPlanes();
// Get centre of the box
Vector3 centre = bound.getCenter();
// Get the half-size of the box
Vector3 halfSize = bound.getHalfSize();
// For each plane, see if all points are on the negative side
// If so, object is not visible
for (int plane = 0; plane < 6; ++plane)
{
// Skip far plane if infinite view frustum
if (plane == FRUSTUM_PLANE_FAR && mFarDist == 0)
continue;
Plane::Side side = mFrustumPlanes[plane].getSide(centre, halfSize);
if (side == Plane::NEGATIVE_SIDE)
{
// ALL corners on negative side therefore out of view
if (culledBy)
*culledBy = (FrustumPlane)plane;
return false;
}
}
return true;
}
Does anyone know why this is? This is rather inefficient for certain types of objects (for example, long skinny ones like telephone poles).

