diff options
author | David Fioramonti | 2017-09-01 21:09:42 -0700 |
---|---|---|
committer | David Fioramonti | 2017-09-02 06:40:41 -0700 |
commit | 1160b88d0670b63cd65bce5742222f4012cc340a (patch) | |
tree | 28808139fa129b5d841ae39d2ab51bb7c7cea8aa | |
parent | b842a43c405138da4583b257fc134a31781caf59 (diff) | |
download | scummvm-rg350-1160b88d0670b63cd65bce5742222f4012cc340a.tar.gz scummvm-rg350-1160b88d0670b63cd65bce5742222f4012cc340a.tar.bz2 scummvm-rg350-1160b88d0670b63cd65bce5742222f4012cc340a.zip |
TITANIC: Swap DAffine for FPose in Orientation and Transforms
More swapping of functions in the Orientation and Transform classes.
-rw-r--r-- | engines/titanic/star_control/fpose.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/star_control/fpose.h | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/fvector.cpp | 17 | ||||
-rw-r--r-- | engines/titanic/star_control/fvector.h | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/orientation_changer.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/unmarked_camera_mover.cpp | 9 |
7 files changed, 34 insertions, 16 deletions
diff --git a/engines/titanic/star_control/fpose.cpp b/engines/titanic/star_control/fpose.cpp index 54cfebd186..2bcb6c36f5 100644 --- a/engines/titanic/star_control/fpose.cpp +++ b/engines/titanic/star_control/fpose.cpp @@ -212,6 +212,18 @@ void FPose::loadTransform(const CMatrixTransform &src) { _vector._z = 0; } +FPose FPose::compose(const FMatrix &m) { + FPose dm; + FPose am; + am._row1 = m._row1; + am._row2 = m._row2; + am._row3 = m._row3; + + fposeProd(*this,am,dm); + + return dm; +} + FPose FPose::compose2(const FPose &m) { FPose dm; dm._row1 = _row1.MatProdRowVect(m); diff --git a/engines/titanic/star_control/fpose.h b/engines/titanic/star_control/fpose.h index d3c43fa439..0fd60a286d 100644 --- a/engines/titanic/star_control/fpose.h +++ b/engines/titanic/star_control/fpose.h @@ -82,6 +82,8 @@ public: */ FPose inverseTransform() const; + FPose compose(const FMatrix &m); + FPose compose2(const FPose &m); }; diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index a53faf58d9..b8cf61ffc4 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -125,22 +125,25 @@ FVector FVector::MatProdRowVect(const FPose &pose) const { return v; } -/*DAffine FVector::getFrameTransform(const FVector &v) { - DAffine matrix1, matrix2, matrix3, matrix4; +FPose FVector::getFrameTransform(const FVector &v) { + FPose matrix1, matrix2, matrix3, matrix4; FVector vector1 = getAnglesAsVect(); matrix1.setRotationMatrix(X_AXIS, vector1._y * Rad2Deg); matrix2.setRotationMatrix(Y_AXIS, vector1._z * Rad2Deg); - matrix3 = matrix1.compose(matrix2); + //matrix3 = matrix1.compose(matrix2); + fposeProd(matrix1,matrix2,matrix3); matrix4 = matrix3.inverseTransform(); vector1 = v.getAnglesAsVect(); matrix1.setRotationMatrix(X_AXIS, vector1._y * Rad2Deg); matrix2.setRotationMatrix(Y_AXIS, vector1._z * Rad2Deg); - matrix3 = matrix1.compose(matrix2); + fposeProd(matrix1,matrix2,matrix3); + //matrix3 = matrix1.compose(matrix2); + fposeProd(matrix4,matrix3,matrix1); - return matrix4.compose(matrix3); -}*/ + return matrix1; //matrix4.compose(matrix3); +} /*DAffine FVector::formRotXY() const { FVector v1 = getAnglesAsVect(); @@ -150,7 +153,7 @@ FVector FVector::MatProdRowVect(const FPose &pose) const { return m1.compose(m2); }*/ -FPose FVector::formRotXY2() const { +FPose FVector::formRotXY() const { FVector v1 = getAnglesAsVect(); FPose m1, m2; m1.setRotationMatrix(X_AXIS, v1._y * Rad2Deg); diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h index 4f4de6330e..49776811d0 100644 --- a/engines/titanic/star_control/fvector.h +++ b/engines/titanic/star_control/fvector.h @@ -117,14 +117,14 @@ public: * Returns a matrix that contains the frame rotation based on this vector and * a vector rotation based on input vector v */ - //DAffine getFrameTransform(const FVector &v); + FPose getFrameTransform(const FVector &v); /** * Constructs an affine matrix that does a x then a y axis frame rotation * based on the orientation of this vector */ //DAffine formRotXY() const; - FPose formRotXY2() const; + FPose formRotXY() const; /** * Returns true if the passed vector equals this one diff --git a/engines/titanic/star_control/orientation_changer.cpp b/engines/titanic/star_control/orientation_changer.cpp index 397574097f..78dfd4b53c 100644 --- a/engines/titanic/star_control/orientation_changer.cpp +++ b/engines/titanic/star_control/orientation_changer.cpp @@ -21,7 +21,7 @@ */ #include "titanic/star_control/orientation_changer.h" -//#include "titanic/star_control/daffine.h" +#include "titanic/star_control/fpose.h" #include "titanic/star_control/fmatrix.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index 5eb25b8f4c..b00173764e 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -336,7 +336,7 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { fposeProd(m1,subX,m11); //m1 = m1.compose(subX); subX = m11.inverseTransform(); - Fpose m12; + FPose m12; fposeProd(subX,subY,m12); //subX = subX.compose(subY); @@ -528,7 +528,7 @@ bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &secondStarPosi FPose m3(0, firstStarPosition); // Identity matrix and row4 as the 1st stars position FVector starDelta = secondStarPosition - firstStarPosition; //DAffine m1 = starDelta.formRotXY(); - FPose m10 = starDelta.formRotXY2(); + FPose m10 = starDelta.formRotXY(); FPose m11; fposeProd(m10,m3,m11); //m1 = m1.compose(m2); diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp index 7295f4a485..3c4d609543 100644 --- a/engines/titanic/star_control/unmarked_camera_mover.cpp +++ b/engines/titanic/star_control/unmarked_camera_mover.cpp @@ -23,8 +23,8 @@ #include "titanic/star_control/unmarked_camera_mover.h" #include "titanic/debugger.h" #include "titanic/star_control/base_stars.h" // includes class CStarVector -#include "titanic/star_control/dvector.h" -#include "titanic/star_control/daffine.h" +//#include "titanic/star_control/dvector.h" +#include "titanic/star_control/fpose.h" #include "titanic/star_control/error_code.h" #include "titanic/star_control/fmatrix.h" // includes class FVector #include "titanic/titanic.h" @@ -52,8 +52,9 @@ void CUnmarkedCameraMover::transitionBetweenOrientations(const FVector &v1, cons FVector vector1 = v1; FVector vector2 = v2; - DAffine matrix1 = vector2.getFrameTransform(vector1); - DAffine matrix2 = matrix1.compose(m); + FPose matrix1 = vector2.getFrameTransform(vector1); + FPose matrix2 = matrix1.compose(m); + //fposeProd(matrix1,m,matrix2); _autoMover.setOrientations(m, matrix2); incLockCount(); |