Plane::getSide bug

Minor issues with the Ogre API that can be trivial to fix
dzel
Gnoblar
Posts: 1
Joined: Wed Jul 13, 2011 5:24 pm

Plane::getSide bug

Post by dzel »

Plane::getSide function has the following code:

Code: Select all

Real fDistance = getDistance(rkPoint);

if ( fDistance < 0.0 )
	return Plane::NEGATIVE_SIDE;

if ( fDistance > 0.0 )
	return Plane::POSITIVE_SIDE;

return Plane::NO_SIDE;
However, NO_SIDE is only returned if fDistance == 0.0, which is not a valid test. Shouldn't the NO_SIDE case be tested first with something like:

Code: Select all

if (fabs(fDistance) < epsilon)
	return Plane::NO_SIDE;
I noticed this as the current implementation causes incorrect shadow clipping on some cases when using FocusedShadowCameraSetup.