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.

This commit is contained in:
Ian Curtis 2017-04-14 23:41:11 +00:00
parent a2fcbf8a3a
commit 21836c088c

View file

@ -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++) {