The hardware actually seems to treat the quad primitive as a triangle strip. The winding order can actually change between the first and second 'triangle' inside the quad, leading our code to incorrectly backface cull the 2nd triangle. So we must re-calculate the winding order for the 2nd triangle. This fixes a massive missing poly in the road in la machine guns, probably other games too. The hardware is unaffected by the winding order, as it doesn't calculate the poly normal from the vertices directly, instead it uses the provided normal in the poly header.

This commit is contained in:
Ian Curtis 2017-02-21 23:35:40 +00:00
parent 5b9741bd5d
commit f173c3c3ce

View file

@ -868,6 +868,11 @@ void CNew3D::CopyVertexData(const R3DPoly& r3dPoly, std::vector<Poly>& polyArray
if (r3dPoly.number == 4) {
V3::createNormal(r3dPoly.v[0].pos, r3dPoly.v[2].pos, r3dPoly.v[3].pos, normal);
dotProd = V3::dotProduct(normal, r3dPoly.faceNormal);
clockWise = dotProd >= 0;
if (clockWise) {
p.p1 = r3dPoly.v[0];
p.p2 = r3dPoly.v[2];