mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
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:
parent
24cbeed526
commit
7407d03036
|
@ -1557,6 +1557,10 @@ void CNew3D::ClipModel(const Model *m)
|
||||||
|
|
||||||
void CNew3D::CalcViewport(Viewport* vp, float near, float far)
|
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 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 r = near * tanf(vp->angle_right);
|
||||||
float t = near * tanf(vp->angle_top);
|
float t = near * tanf(vp->angle_top);
|
||||||
|
|
Loading…
Reference in a new issue