diff options
-rw-r--r-- | engines/titanic/star_control/fpose.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/fpose.h | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/engines/titanic/star_control/fpose.cpp b/engines/titanic/star_control/fpose.cpp index 3f7b03df85..98de447e85 100644 --- a/engines/titanic/star_control/fpose.cpp +++ b/engines/titanic/star_control/fpose.cpp @@ -83,6 +83,7 @@ void FPose::identity() { _vector.clear(); } +// Source: https://en.wikipedia.org/wiki/Rotation_matrix void FPose::setRotationMatrix(Axis axis, float amount) { const float ROTATION = 2 * M_PI / 360.0; float sinVal = sin(amount * ROTATION); @@ -104,11 +105,11 @@ void FPose::setRotationMatrix(Axis axis, float amount) { case Y_AXIS: _row1._x = cosVal; _row1._y = 0.0; - _row1._z = sinVal; + _row1._z = -sinVal; _row2._x = 0.0; _row2._y = 1.0; _row2._z = 0.0; - _row3._x = -sinVal; + _row3._x = sinVal; _row3._y = 0.0; _row3._z = cosVal; break; @@ -145,6 +146,7 @@ void FPose::copyFrom(const FMatrix &src) { _row3 = src._row3; } +// This looks like DAffine DAffine::inverseTransform() FPose FPose::fn4() const { float v2, v3, v6, v7, v8, v9, v10, v11; float v12, v13, v14, v15, v16, v17, v18; diff --git a/engines/titanic/star_control/fpose.h b/engines/titanic/star_control/fpose.h index dbdd832067..02e00c914d 100644 --- a/engines/titanic/star_control/fpose.h +++ b/engines/titanic/star_control/fpose.h @@ -29,6 +29,7 @@ namespace Titanic { /* * This class combines a position and orientation in 3D space + * TODO: consider merging with DAffine */ class FPose : public FMatrix { public: @@ -59,6 +60,9 @@ public: */ void copyFrom(const FMatrix &src); + /** + * Probably the inverse of the this 3x4 + */ FPose fn4() const; }; diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index f1723856fc..9c1c598ede 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -230,14 +230,14 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { if (_matrixRow == -1) { // No locked markers FPose subX(X_AXIS, angles._y); - FPose subY(Y_AXIS, angles._x); + FPose subY(Y_AXIS, -angles._x); // needs to be negative or looking left will cause the view to go right FPose sub(subX, subY); proc22(sub); } else if (_matrixRow == 0) { // 1 marker is locked in FVector row1 = _matrix._row1; FPose poseX(X_AXIS, angles._y); - FPose poseY(Y_AXIS, angles._x); + FPose poseY(Y_AXIS, -angles._x); // needs to be negative or looking left will cause the view to go right FPose pose(poseX, poseY); FMatrix m1 = _viewport.getOrientation(); |