public bool intersects( AxisAlignedBox aab )
{
// Only check if portal is open
if ( mOpen )
{
switch ( mType )
{
case PORTAL_TYPE.PORTAL_TYPE_QUAD:
// since ogre doesn't have built in support for a quad, just check
// if the box intersects both the sphere of the portal and the plane
// this can result in false positives, but they will be minimal
if ( !aab.Intersects( mDerivedSphere ) )
{
return false;
}
if ( aab.Intersects( mDerivedPlane ) )
{
return true;
}
break;
case PORTAL_TYPE.PORTAL_TYPE_AABB:
{
// aab to aab check
AxisAlignedBox aabb = new AxisAlignedBox( mDerivedCorners[ 0 ], mDerivedCorners[ 1 ] );
return ( aab.Intersects( aabb ) );
}
case PORTAL_TYPE.PORTAL_TYPE_SPHERE:
// aab to sphere check
return ( aab.Intersects( mDerivedSphere ) );
}
}
return false;
}