From 21836c088c06e1eedc85f7a1d0c8d888cd2fdeb4 Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Fri, 14 Apr 2017 23:41:11 +0000 Subject: [PATCH] The real3d has a flag that allows the hw to skip polygons so that they aren't rendered. Sega rally2 uses this for the dust effects. Triangles or quads that have this flag are junk, and look like random corruption if you try to draw them. We assumed polys that shared vertices with these bad polygons were also bad. It turns out the last few shared vertices in these polys were in fact valid, and thus the entire quad/triangle strip should be drawn and not discarded. --- Src/Graphics/New3D/New3D.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp index 9013fa8..1d7ab07 100644 --- a/Src/Graphics/New3D/New3D.cpp +++ b/Src/Graphics/New3D/New3D.cpp @@ -1022,7 +1022,6 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data) UINT16 texCoords[4][2]; UINT16 prevTexCoords[4][2]; PolyHeader ph; - int numPolys = 0; UINT64 lastHash = -1; SortingMesh* currentMesh = nullptr; @@ -1045,10 +1044,6 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data) break; } - if (ph.Disabled() || !numPolys && (ph.NumSharedVerts() != 0)) { - continue; - } - // create a hash value based on poly attributes -todo add more attributes auto hash = ph.Hash(); @@ -1205,7 +1200,7 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data) } // check if we need double up vertices for two sided lighting - if (ph.DoubleSided()) { + if (ph.DoubleSided() && !ph.Disabled()) { R3DPoly tempP = p; @@ -1220,8 +1215,9 @@ void CNew3D::CacheModel(Model *m, const UINT32 *data) } // Copy this polygon into the model buffer - CopyVertexData(p, currentMesh->polys); - numPolys++; + if (!ph.Disabled()) { + CopyVertexData(p, currentMesh->polys); + } // Copy current vertices into previous vertex array for (i = 0; i < 4; i++) {