/* special function that returns true only when sphere fully fits inside the frustum. */ bool PCZFrustum::isFullyVisible(const Sphere& bound) const { // Check originplane if told to if (mUseOriginPlane) { if (mOriginPlane.getDistance(bound.getCenter()) <= bound.getRadius() || mOriginPlane.getSide(bound.getCenter()) != Plane::POSITIVE_SIDE) { return false; } } // For each extra active culling plane, // see if the sphere is not on the positive side // If so, object is not fully visible PCPlaneList::const_iterator pit = mActiveCullingPlanes.begin(); while ( pit != mActiveCullingPlanes.end() ) { PCPlane* plane = *pit; if (plane->getDistance(bound.getCenter()) <= bound.getRadius() || plane->getSide(bound.getCenter()) != Plane::POSITIVE_SIDE) { return false; } pit++; } return true; }
bool PCZFrustum::isVisible( const Sphere & bound) const { // Check originplane if told to if (mUseOriginPlane) { Plane::Side side = mOriginPlane.getSide(bound.getCenter()); if (side == Plane::NEGATIVE_SIDE) { Real dist = mOriginPlane.getDistance(bound.getCenter()); if (dist > bound.getRadius()) { return false; } } } // For each extra active culling plane, see if the entire sphere is on the negative side // If so, object is not visible PCPlaneList::const_iterator pit = mActiveCullingPlanes.begin(); while ( pit != mActiveCullingPlanes.end() ) { PCPlane * plane = *pit; Plane::Side xside = plane->getSide(bound.getCenter()); if (xside == Plane::NEGATIVE_SIDE) { Real dist = plane->getDistance(bound.getCenter()); if (dist > bound.getRadius()) { return false; } } pit++; } return true; }