diff options
author | David Fioramonti | 2017-09-01 19:45:37 -0700 |
---|---|---|
committer | David Fioramonti | 2017-09-02 06:40:41 -0700 |
commit | b842a43c405138da4583b257fc134a31781caf59 (patch) | |
tree | 34847b2f9271b44028215fde0bfbfc57672c74ca /engines/titanic | |
parent | 910e221861fc0003984ba68e60f4250ba8f7a921 (diff) | |
download | scummvm-rg350-b842a43c405138da4583b257fc134a31781caf59.tar.gz scummvm-rg350-b842a43c405138da4583b257fc134a31781caf59.tar.bz2 scummvm-rg350-b842a43c405138da4583b257fc134a31781caf59.zip |
TITANIC: Swap DAffine usage for FPose in setViewportAngle
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/star_control/fmatrix.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/star_control/fmatrix.h | 10 | ||||
-rw-r--r-- | engines/titanic/star_control/fvector.cpp | 20 | ||||
-rw-r--r-- | engines/titanic/star_control/fvector.h | 12 | ||||
-rw-r--r-- | engines/titanic/star_control/matrix_transform.cpp | 1 | ||||
-rw-r--r-- | engines/titanic/star_control/matrix_transform.h | 1 | ||||
-rw-r--r-- | engines/titanic/star_control/orientation_changer.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 36 |
8 files changed, 50 insertions, 48 deletions
diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp index bb002fa4b3..ebdb6c2a5f 100644 --- a/engines/titanic/star_control/fmatrix.cpp +++ b/engines/titanic/star_control/fmatrix.cpp @@ -21,7 +21,6 @@ */ #include "titanic/star_control/fmatrix.h" -#include "titanic/star_control/daffine.h" #include "titanic/support/simple_file.h" namespace Titanic { @@ -52,9 +51,9 @@ FMatrix::FMatrix(const FVector &row1, const FVector &row2, const FVector &row3) _row3 = row3; } -FMatrix::FMatrix(const DAffine &src) { +/*FMatrix::FMatrix(const DAffine &src) { copyFrom(src); -} +}*/ FMatrix::FMatrix(const FMatrix &src) { _row1 = src._row1; @@ -62,11 +61,11 @@ FMatrix::FMatrix(const FMatrix &src) { _row3 = src._row3; } -void FMatrix::copyFrom(const DAffine &src) { +/*void FMatrix::copyFrom(const DAffine &src) { _row1 = src._col1; _row2 = src._col2; _row3 = src._col3; -} +}*/ void FMatrix::load(SimpleFile *file, int param) { _row1._x = file->readFloat(); @@ -116,11 +115,11 @@ void FMatrix::set(const FVector &row1, const FVector &row2, const FVector &row3) _row3 = row3; } -void FMatrix::set(const DVector &row1, const DVector &row2, const DVector &row3) { +/*void FMatrix::set(const DVector &row1, const DVector &row2, const DVector &row3) { _row1 = row1; _row2 = row2; _row3 = row3; -} +}*/ void FMatrix::set(const FVector &v) { _row3 = v; diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index 6d118a73a6..c1d0c6bf16 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -27,8 +27,8 @@ namespace Titanic { -class DAffine; -class DVector; +//class DAffine; +//class DVector; class SimpleFile; /** @@ -40,7 +40,7 @@ private: /** * Copys data from a given source */ - void copyFrom(const DAffine &src); + //void copyFrom(const DAffine &src); public: FVector _row1; FVector _row2; @@ -48,7 +48,7 @@ public: public: FMatrix(); FMatrix(const FVector &, const FVector &, const FVector &); - FMatrix(const DAffine &src); + //FMatrix(const DAffine &src); FMatrix(const FMatrix &src); /** @@ -84,7 +84,7 @@ public: /** * Sets the data for the matrix */ - void set(const DVector &row1, const DVector &row2, const DVector &row3); + //void set(const DVector &row1, const DVector &row2, const DVector &row3); /** * Sets the data for the matrix from a vector diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index 5e87ebc7e9..a53faf58d9 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -21,16 +21,16 @@ */ #include "titanic/star_control/fvector.h" -#include "titanic/star_control/dvector.h" -#include "titanic/star_control/daffine.h" +//#include "titanic/star_control/dvector.h" +//#include "titanic/star_control/daffine.h" #include "titanic/star_control/fpose.h" //#include "common/algorithm.h" //#include "common/textconsole.h" namespace Titanic { -FVector::FVector(const DVector &src) : _x(src._x), _y(src._y), _z(src._z) { -} +//FVector::FVector(const DVector &src) : _x(src._x), _y(src._y), _z(src._z) { +//} FVector FVector::swapComponents() const { return FVector( @@ -109,13 +109,13 @@ float FVector::getDistance(const FVector &src) const { return sqrt(xd * xd + yd * yd + zd * zd); } -FVector FVector::MatProdColVect(const DAffine &pose) const { +/*FVector FVector::MatProdColVect(const DAffine &pose) const { FVector v; v._x = pose._col1._x * _x + pose._col2._x * _y + pose._col3._x * _z + pose._col4._x; v._y = pose._col1._y * _x + pose._col2._y * _y + pose._col3._y * _z + pose._col4._y; v._z = pose._col1._z * _x + pose._col2._z * _y + pose._col3._z * _z + pose._col4._z; return v; -} +}*/ FVector FVector::MatProdRowVect(const FPose &pose) const { FVector v; @@ -125,7 +125,7 @@ FVector FVector::MatProdRowVect(const FPose &pose) const { return v; } -DAffine FVector::getFrameTransform(const FVector &v) { +/*DAffine FVector::getFrameTransform(const FVector &v) { DAffine matrix1, matrix2, matrix3, matrix4; FVector vector1 = getAnglesAsVect(); @@ -140,15 +140,15 @@ DAffine FVector::getFrameTransform(const FVector &v) { matrix3 = matrix1.compose(matrix2); return matrix4.compose(matrix3); -} +}*/ -DAffine FVector::formRotXY() const { +/*DAffine FVector::formRotXY() const { FVector v1 = getAnglesAsVect(); DAffine m1, m2; m1.setRotationMatrix(X_AXIS, v1._y * Rad2Deg); m2.setRotationMatrix(Y_AXIS, v1._z * Rad2Deg); return m1.compose(m2); -} +}*/ FPose FVector::formRotXY2() const { FVector v1 = getAnglesAsVect(); diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h index 9bf6a55cce..4f4de6330e 100644 --- a/engines/titanic/star_control/fvector.h +++ b/engines/titanic/star_control/fvector.h @@ -32,8 +32,8 @@ const double Deg2Rad = 1.0 / Rad2Deg; enum Axis { X_AXIS, Y_AXIS, Z_AXIS }; class FPose; -class DVector; -class DAffine; +//class DVector; +//class DAffine; /** * Floating point vector class. @@ -45,7 +45,7 @@ public: public: FVector() : _x(0), _y(0), _z(0) {} FVector(float x, float y, float z) : _x(x), _y(y), _z(z) {} - FVector(const DVector &src); + //FVector(const DVector &src); /** * Clears the vector @@ -111,19 +111,19 @@ public: * Returns a vector that is this vector on the right as a column vector * times the 4x3 fpose matrix on the left. */ - FVector MatProdColVect(const DAffine &pose) const; + //FVector MatProdColVect(const DAffine &pose) const; /** * 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); + //DAffine 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; + //DAffine formRotXY() const; FPose formRotXY2() const; /** diff --git a/engines/titanic/star_control/matrix_transform.cpp b/engines/titanic/star_control/matrix_transform.cpp index e9f04c97bd..0511ba678b 100644 --- a/engines/titanic/star_control/matrix_transform.cpp +++ b/engines/titanic/star_control/matrix_transform.cpp @@ -21,7 +21,6 @@ */ #include "titanic/star_control/matrix_transform.h" -//#include "titanic/star_control/daffine.h" #include "titanic/star_control/fpose.h" #include "common/textconsole.h" diff --git a/engines/titanic/star_control/matrix_transform.h b/engines/titanic/star_control/matrix_transform.h index 2043e8de76..6cadb27754 100644 --- a/engines/titanic/star_control/matrix_transform.h +++ b/engines/titanic/star_control/matrix_transform.h @@ -23,7 +23,6 @@ #ifndef TITANIC_MATRIX_TRANSFORM_H #define TITANIC_MATRIX_TRANSFORM_H -//#include "titanic/star_control/dvector.h" #include "titanic/star_control/fvector.h" namespace Titanic { diff --git a/engines/titanic/star_control/orientation_changer.cpp b/engines/titanic/star_control/orientation_changer.cpp index e6d52df212..397574097f 100644 --- a/engines/titanic/star_control/orientation_changer.cpp +++ b/engines/titanic/star_control/orientation_changer.cpp @@ -21,8 +21,8 @@ */ #include "titanic/star_control/orientation_changer.h" -#include "titanic/star_control/daffine.h" -#include "titanic/star_control/fpose.h" +//#include "titanic/star_control/daffine.h" +#include "titanic/star_control/fmatrix.h" namespace Titanic { @@ -42,7 +42,6 @@ FMatrix COrientationChanger::getOrientation(double percent) { } else { CMatrixTransform tfm = _sub1.fn5(percent, _sub2); - //DAffine m1; FPose m1; m1.loadTransform(tfm); return m1; diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index 88c943e685..5eb25b8f4c 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -320,19 +320,25 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { case TWO_LOCKED: { FVector tempV2; - DAffine m1; + FPose m1; FVector mrow1, mrow2, mrow3; FVector tempV1, diffV, multV, multV2, tempV3, tempV7; - DAffine subX(0, _lockedStarsPos._row1); - DAffine subY(Y_AXIS, angles._y); + //DAffine subX(0, _lockedStarsPos._row1); + FPose subX(0, _lockedStarsPos._row1); + FPose subY(Y_AXIS, angles._y); + //DAffine subY(Y_AXIS, angles._y); tempV1 = _lockedStarsPos._row2 - _lockedStarsPos._row1; diffV = tempV1; m1 = diffV.formRotXY(); - m1 = m1.compose(subX); - subX = m1.inverseTransform(); - subX = subX.compose(subY); + FPose m11; + fposeProd(m1,subX,m11); + //m1 = m1.compose(subX); + subX = m11.inverseTransform(); + Fpose m12; + fposeProd(subX,subY,m12); + //subX = subX.compose(subY); FMatrix m3 = _viewport.getOrientation(); tempV2 = _viewport._position; @@ -361,15 +367,15 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { tempV7._x = m3._row3._x * rowScale2 + tempV3._x; mrow3 = tempV7; - tempV3 = tempV3.MatProdColVect(subX); - mrow1 = mrow1.MatProdColVect(subX); - mrow2 = mrow2.MatProdColVect(subX); - mrow3 = mrow3.MatProdColVect(subX); - - tempV3 = tempV3.MatProdColVect(m1); - mrow1 = mrow1.MatProdColVect(m1); - mrow2 = mrow2.MatProdColVect(m1); - mrow3 = mrow3.MatProdColVect(m1); + tempV3 = tempV3.MatProdRowVect(m12); + mrow1 = mrow1.MatProdRowVect(m12); + mrow2 = mrow2.MatProdRowVect(m12); + mrow3 = mrow3.MatProdRowVect(m12); + + tempV3 = tempV3.MatProdRowVect(m11); + mrow1 = mrow1.MatProdRowVect(m11); + mrow2 = mrow2.MatProdRowVect(m11); + mrow3 = mrow3.MatProdRowVect(m11); mrow1 -= tempV3; mrow2 -= tempV3; |