From 64cd34412c9fc277e9fc9f997e8ec73a36cb26ec Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Mon, 26 Sep 2022 00:30:20 +0200 Subject: [PATCH] Fixed math problem and transposed idMat4::ToMat3() --- neo/idlib/math/Matrix.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/neo/idlib/math/Matrix.h b/neo/idlib/math/Matrix.h index 437de0f0..c78f1a72 100644 --- a/neo/idlib/math/Matrix.h +++ b/neo/idlib/math/Matrix.h @@ -976,14 +976,15 @@ ID_INLINE idMat3 idMat4::ToMat3() const { idMat3 m; + // RB - NOTE: idMat3 is transposed because it is column-major m[0][0] = mat[0][0]; - m[0][1] = mat[0][1]; - m[0][2] = mat[0][2]; - m[1][0] = mat[1][0]; + m[0][1] = mat[1][0]; + m[0][2] = mat[2][0]; + m[1][0] = mat[0][1]; m[1][1] = mat[1][1]; - m[1][2] = mat[1][2]; - m[2][0] = mat[2][0]; - m[2][1] = mat[2][1]; + m[1][2] = mat[2][1]; + m[2][0] = mat[0][2]; + m[2][1] = mat[1][2]; m[2][2] = mat[2][2]; return m;