From 06b43c45b3021a1f54cf177980215a10c6ebb475 Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Sat, 2 Nov 2019 20:11:48 +0000 Subject: [PATCH] Ocean hunter in the middle of the game is passing a few matrices with FLT_MAX inside them, which blows apart our near/far calculation. The hardware must have some method to sanitize the near/far for instance if you render something extremely close to the origin you will also blow apart any near/far calc. --- Src/Graphics/New3D/New3D.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp index b8e1491..a726d6a 100644 --- a/Src/Graphics/New3D/New3D.cpp +++ b/Src/Graphics/New3D/New3D.cpp @@ -1584,6 +1584,10 @@ void CNew3D::ClipModel(const Model *m) void CNew3D::CalcViewport(Viewport* vp, float near, float far) { + if (far > 1e30) { + far = near * 1000000; // fix for ocean hunter which passes some FLT_MAX for a few matrices. HW must have some safe guard for these + } + if (near < far / 1000000) { near = far / 1000000; // if we get really close to zero somehow, we will have almost no depth precision }