Fix frustum cull oddity with planets

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5563 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Chris Morris 2012-12-06 18:13:54 +00:00
parent 08bb0b3214
commit 6f295e6b25

View File

@ -751,10 +751,17 @@ static const BaseFace kTexturedFaces[][3] =
- (void) drawImmediate:(bool)immediate translucent:(bool)translucent
{
if ([UNIVERSE breakPatternHide] || translucent || immediate) return; // DON'T DRAW
if (![UNIVERSE viewFrustumIntersectsSphereAt:position withRadius:([self radius] + ATMOSPHERE_DEPTH)])
GLfloat radWithAtmosphere = [self radius] + ATMOSPHERE_DEPTH;
if (radWithAtmosphere * radWithAtmosphere * 1.1 < cam_zero_distance)
{
// Don't draw
return;
// for some reason this check doesn't work when extremely close to
// the planet and with the horizon near the side of the frame (FP
// inaccuracy?)
if (![UNIVERSE viewFrustumIntersectsSphereAt:position withRadius:radWithAtmosphere])
{
// Don't draw
return;
}
}
[self drawUnconditionally];