Fix docking bug when dock is very marginally off-centre.

Fix frustum culling bug with extremely large objects.


git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5646 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Chris Morris 2013-03-05 18:27:16 +00:00
parent e4801d7919
commit fb8277c053
2 changed files with 7 additions and 7 deletions

View File

@ -252,7 +252,7 @@ MA 02110-1301, USA.
- (BOOL) isOffCentre - (BOOL) isOffCentre
{ {
if (fabs(position.x) + fabs(position.y) > 0.1f) if (fabs(position.x) + fabs(position.y) > 5.0f)
{ {
return YES; return YES;
} }

View File

@ -91,11 +91,11 @@ MA 02110-1301, USA.
OOVisualEffectEntity* veself = (OOVisualEffectEntity*)self; OOVisualEffectEntity* veself = (OOVisualEffectEntity*)self;
clipradius = [veself frustumRadius]; clipradius = [veself frustumRadius];
} }
// don't bother with frustum culling within 1km, as potential for // don't bother with frustum culling within/near collision radius, as
// problems with floating point inaccuracy causing unwanted disappearance // potential for problems with floating point inaccuracy causing
// maybe fix http://aegidian.org/bb/viewtopic.php?f=3&t=13619 // unwanted disappearance maybe fix
// - CIM // http://aegidian.org/bb/viewtopic.php?f=3&t=13619 - CIM
if (cam_zero_distance > 1000000) if (cam_zero_distance > (clipradius+1000)*(clipradius+1000))
{ {
if (![UNIVERSE viewFrustumIntersectsSphereAt:position withRadius:clipradius]) if (![UNIVERSE viewFrustumIntersectsSphereAt:position withRadius:clipradius])
{ {
@ -106,7 +106,7 @@ MA 02110-1301, USA.
else else
{ {
// don't bother with frustum culling within 1km, as above - CIM // don't bother with frustum culling within 1km, as above - CIM
if (cam_zero_distance > 1000000) if (cam_zero_distance > (collision_radius+1000)*(collision_radius+1000))
{ {
// check correct sub-entity position // check correct sub-entity position
if (![UNIVERSE viewFrustumIntersectsSphereAt:[self absolutePositionForSubentity] withRadius:[self collisionRadius]]) if (![UNIVERSE viewFrustumIntersectsSphereAt:[self absolutePositionForSubentity] withRadius:[self collisionRadius]])