diff options
author | David Fioramonti | 2017-08-14 17:17:05 -0700 |
---|---|---|
committer | David Fioramonti | 2017-08-15 14:41:48 -0700 |
commit | 4bd42373ce7867d499169c1fa7ee8825b5a54e15 (patch) | |
tree | c3cef8833f92447cfe8a3f9b9fe97e3b15937d75 /engines/titanic | |
parent | 970e4b2e8a72d62d1e3499aca98b7386ebf7eca9 (diff) | |
download | scummvm-rg350-4bd42373ce7867d499169c1fa7ee8825b5a54e15.tar.gz scummvm-rg350-4bd42373ce7867d499169c1fa7ee8825b5a54e15.tar.bz2 scummvm-rg350-4bd42373ce7867d499169c1fa7ee8825b5a54e15.zip |
TITANIC: star control, fmatrix refactoring
renamed fn2->MatRProd and fn3->MatLProd.
They do post (R) and pre (L) multiplication.
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/star_control/fmatrix.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/fmatrix.h | 15 | ||||
-rw-r--r-- | engines/titanic/star_control/viewport.cpp | 4 |
3 files changed, 17 insertions, 6 deletions
diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp index 23a2ce2203..21b2e4e385 100644 --- a/engines/titanic/star_control/fmatrix.cpp +++ b/engines/titanic/star_control/fmatrix.cpp @@ -104,7 +104,7 @@ void FMatrix::set(const FVector &v) { _row2.normalize(); } -void FMatrix::fn2(const FMatrix &m) { +void FMatrix::matRProd(const FMatrix &m) { float x1 = _row1._y * m._row2._x + _row1._z * m._row3._x + _row1._x * m._row1._x; float y1 = _row1._x * m._row1._y + m._row2._y * _row1._y + m._row3._y * _row1._z; float z1 = _row1._x * m._row1._z + _row1._y * m._row2._z + _row1._z * m._row3._z; @@ -120,7 +120,7 @@ void FMatrix::fn2(const FMatrix &m) { _row3 = FVector(x3, y3, z3); } -void FMatrix::fn3(const FMatrix &m) { +void FMatrix::matLProd(const FMatrix &m) { float x1 = _row2._x * m._row1._y + m._row1._z * _row3._x + _row1._x * m._row1._x; float y1 = m._row1._x * _row1._y + _row3._y * m._row1._z + _row2._y * m._row1._y; float z1 = m._row1._x * _row1._z + m._row1._y * _row2._z + m._row1._z * _row3._z; diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index 95bb91cf73..e783a2342c 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -85,8 +85,19 @@ public: */ void set(const FVector &v); - void fn2(const FMatrix &m); - void fn3(const FMatrix &m); + /** + * Changes this matrix, A, to be C, where C=Am. + * Matrix m multiplies this matrix (A) on its Right. + * Matrix m is said to premultiply A (previous this matrix). + */ + void matRProd(const FMatrix &m); + + /** + * Changes this matrix, A, to be C, where C=mA. + * Matrix m multiplies this matrix (A) on its Left. + * m is said to postmultiply A (previous this matrix). + */ + void matLProd(const FMatrix &m); /** * Returns true if the passed matrix equals this one diff --git a/engines/titanic/star_control/viewport.cpp b/engines/titanic/star_control/viewport.cpp index c3625b85c4..39d2c5f201 100644 --- a/engines/titanic/star_control/viewport.cpp +++ b/engines/titanic/star_control/viewport.cpp @@ -156,7 +156,7 @@ void CViewport::fn12() { FPose s2(s1, m3); m1.copyFrom(s2); - _orientation.fn2(m1); + _orientation.matRProd(m1); _flag = false; } @@ -181,7 +181,7 @@ void CViewport::reposition(double factor) { } void CViewport::fn15(const FMatrix &matrix) { - _orientation.fn3(matrix); + _orientation.matLProd(matrix); _flag = false; } |