summaryrefslogtreecommitdiff
path: root/src/math/Matrix.h
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-27 01:46:48 +0300
committerSergeanur <s.anureev@yandex.ua>2019-10-27 01:46:48 +0300
commitfcfdaa9534c67bc0affee73af80b12ffc82dfd05 (patch)
tree1009d915cbc9d166177cc218afc116761cc55ae1 /src/math/Matrix.h
parentc3c6c5100346c8c56e7aa7ea7efd3250b8c5a1a3 (diff)
cAudioManager::TranslateEntity cleanup
Diffstat (limited to 'src/math/Matrix.h')
-rw-r--r--src/math/Matrix.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/math/Matrix.h b/src/math/Matrix.h
index 96f56a0f..da38cb1d 100644
--- a/src/math/Matrix.h
+++ b/src/math/Matrix.h
@@ -249,7 +249,15 @@ public:
CMatrix &Invert(const CMatrix &src, CMatrix &dst);
CVector operator*(const CMatrix &mat, const CVector &vec);
CMatrix operator*(const CMatrix &m1, const CMatrix &m2);
-CVector MultiplyInverse(const CMatrix &mat, const CVector &vec);
+inline CVector MultiplyInverse(const CMatrix &mat, const CVector &vec)
+{
+ CVector v(vec.x - mat.m_matrix.pos.x, vec.y - mat.m_matrix.pos.y, vec.z - mat.m_matrix.pos.z);
+ return CVector(
+ mat.m_matrix.right.x * v.x + mat.m_matrix.right.y * v.y + mat.m_matrix.right.z * v.z,
+ mat.m_matrix.up.x * v.x + mat.m_matrix.up.y * v.y + mat.m_matrix.up.z * v.z,
+ mat.m_matrix.at.x * v.x + mat.m_matrix.at.y * v.y + mat.m_matrix.at.z * v.z);
+}
+
const CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
const CVector Multiply3x3(const CVector &vec, const CMatrix &mat);