From 47ef79672e58417899a3dbf1361691059e9f5dd8 Mon Sep 17 00:00:00 2001 From: Johannes Unterguggenberger Date: Mon, 29 Apr 2024 21:03:57 +0200 Subject: [PATCH] Reverts the changes introduced by commit ad766cb in February 2022. (#5542) * Reverts the changes introduced by commit ad766cb in February 2022. Explanation why the old code was just fine is given in Q&A #5512. * Added that missing ; --------- Co-authored-by: Kim Kulling --- code/PostProcessing/CalcTangentsProcess.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/PostProcessing/CalcTangentsProcess.cpp b/code/PostProcessing/CalcTangentsProcess.cpp index 82fde1348..abd0aee47 100644 --- a/code/PostProcessing/CalcTangentsProcess.cpp +++ b/code/PostProcessing/CalcTangentsProcess.cpp @@ -185,9 +185,9 @@ bool CalcTangentsProcess::ProcessMesh(aiMesh *pMesh, unsigned int meshIndex) { tangent.x = (w.x * sy - v.x * ty) * dirCorrection; tangent.y = (w.y * sy - v.y * ty) * dirCorrection; tangent.z = (w.z * sy - v.z * ty) * dirCorrection; - bitangent.x = (- w.x * sx + v.x * tx) * dirCorrection; - bitangent.y = (- w.y * sx + v.y * tx) * dirCorrection; - bitangent.z = (- w.z * sx + v.z * tx) * dirCorrection; + bitangent.x = (w.x * sx - v.x * tx) * dirCorrection; + bitangent.y = (w.y * sx - v.y * tx) * dirCorrection; + bitangent.z = (w.z * sx - v.z * tx) * dirCorrection; // store for every vertex of that face for (unsigned int b = 0; b < face.mNumIndices; ++b) { @@ -195,7 +195,7 @@ bool CalcTangentsProcess::ProcessMesh(aiMesh *pMesh, unsigned int meshIndex) { // project tangent and bitangent into the plane formed by the vertex' normal aiVector3D localTangent = tangent - meshNorm[p] * (tangent * meshNorm[p]); - aiVector3D localBitangent = bitangent - meshNorm[p] * (bitangent * meshNorm[p]) - localTangent * (bitangent * localTangent); + aiVector3D localBitangent = bitangent - meshNorm[p] * (bitangent * meshNorm[p]); localTangent.NormalizeSafe(); localBitangent.NormalizeSafe();