aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/Matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/Matrix.cpp')
-rw-r--r--src/math/Matrix.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/math/Matrix.cpp b/src/math/Matrix.cpp
index b11e8a1c..c0d909cb 100644
--- a/src/math/Matrix.cpp
+++ b/src/math/Matrix.cpp
@@ -453,63 +453,50 @@ CMatrix &
Invert(const CMatrix &src, CMatrix &dst)
{
// TODO: VU0 code
- // GTA handles this as a raw 4x4 orthonormal matrix
- // and trashes the RW flags, let's not do that
dst.f[3][0] = dst.f[3][1] = dst.f[3][2] = 0.0f;
-#ifndef FIX_BUGS
- dst.f[3][3] = src.f[3][3];
-#endif
dst.f[0][0] = src.f[0][0];
dst.f[0][1] = src.f[1][0];
dst.f[0][2] = src.f[2][0];
-#ifndef FIX_BUGS
- dst.f[0][3] = src.f[3][0];
-#endif
+
dst.f[1][0] = src.f[0][1];
dst.f[1][1] = src.f[1][1];
dst.f[1][2] = src.f[2][1];
-#ifndef FIX_BUGS
- dst.f[1][3] = src.f[3][1];
-#endif
+
dst.f[2][0] = src.f[0][2];
dst.f[2][1] = src.f[1][2];
dst.f[2][2] = src.f[2][2];
-#ifndef FIX_BUGS
- dst.f[2][3] = src.f[3][2];
-#endif
+
dst.f[3][0] += dst.f[0][0] * src.f[3][0];
dst.f[3][1] += dst.f[0][1] * src.f[3][0];
dst.f[3][2] += dst.f[0][2] * src.f[3][0];
-#ifndef FIX_BUGS
- dst.f[3][3] += dst.f[0][3] * src.f[3][0];
-#endif
dst.f[3][0] += dst.f[1][0] * src.f[3][1];
dst.f[3][1] += dst.f[1][1] * src.f[3][1];
dst.f[3][2] += dst.f[1][2] * src.f[3][1];
-#ifndef FIX_BUGS
- dst.f[3][3] += dst.f[1][3] * src.f[3][1];
-#endif
dst.f[3][0] += dst.f[2][0] * src.f[3][2];
dst.f[3][1] += dst.f[2][1] * src.f[3][2];
dst.f[3][2] += dst.f[2][2] * src.f[3][2];
-#ifndef FIX_BUGS
- dst.f[3][3] += dst.f[2][3] * src.f[3][2];
-#endif
dst.f[3][0] = -dst.f[3][0];
dst.f[3][1] = -dst.f[3][1];
dst.f[3][2] = -dst.f[3][2];
-#ifndef FIX_BUGS
- dst.f[3][3] = src.f[3][3] - dst.f[3][3];
-#endif
return dst;
}
+void
+CMatrix::CopyToRwMatrix(RwMatrix* matrix)
+{
+ matrix->right = GetRight();
+ matrix->up = GetForward();
+ matrix->at = GetUp();
+ matrix->pos = GetPosition();
+ RwMatrixUpdate(matrix);
+}
+
CMatrix
Invert(const CMatrix &matrix)
{