Put a check in there, in case near values come out really close to zero. Fixes a slight corner case in lemans24. A check probably should have been there originally :)

This commit is contained in:
Ian Curtis 2017-02-08 16:14:50 +00:00
parent 24cbeed526
commit 7407d03036

View file

@ -1557,6 +1557,10 @@ void CNew3D::ClipModel(const Model *m)
void CNew3D::CalcViewport(Viewport* vp, float near, float far)
{
if (near < far / 1000000) {
near = far / 1000000; // if we get really close to zero somehow, we will have almost no depth precision
}
float l = near * tanf(vp->angle_left); // we need to calc the shape of the projection frustum for culling
float r = near * tanf(vp->angle_right);
float t = near * tanf(vp->angle_top);