From d6a59be012908bd7324b07a0b3beea06c896a82e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 20 Oct 2022 23:09:48 -0700 Subject: [PATCH] softgpu: Respect negate normal flag without norm. Per tests, Z is still negated even when using the previous normal value. --- GPU/Software/TransformUnit.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index fbbdcd3919..ac52ef180f 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -337,17 +337,12 @@ ClipVertexData TransformUnit::ReadVertex(VertexReader &vreader, const TransformS vertex.v.texturecoords = lastTC; } - Vec3f normal; static Vec3f lastnormal; - if (vreader.hasNormal()) { - vreader.ReadNrm(normal.AsArray()); - lastnormal = normal; - - if (state.negateNormals) - normal = -normal; - } else { - normal = lastnormal; - } + if (vreader.hasNormal()) + vreader.ReadNrm(lastnormal.AsArray()); + Vec3f normal = lastnormal; + if (state.negateNormals) + normal = -normal; if (state.readWeights) { float W[8] = { 1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f };