[Scummvm-git-logs] scummvm master -> 9cc1f09f2c55aa94ac85cf7c5d87af7dfc5a0935

dreammaster dreammaster at scummvm.org
Sun Aug 13 21:22:32 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9cc1f09f2c TITANIC: Further cleanup of DVector class


Commit: 9cc1f09f2c55aa94ac85cf7c5d87af7dfc5a0935
    https://github.com/scummvm/scummvm/commit/9cc1f09f2c55aa94ac85cf7c5d87af7dfc5a0935
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-08-13T15:22:26-04:00

Commit Message:
TITANIC: Further cleanup of DVector class

Changed paths:
    engines/titanic/star_control/dvector.cpp
    engines/titanic/star_control/dvector.h
    engines/titanic/star_control/star_camera.cpp


diff --git a/engines/titanic/star_control/dvector.cpp b/engines/titanic/star_control/dvector.cpp
index 8ea167a..1f873b5 100644
--- a/engines/titanic/star_control/dvector.cpp
+++ b/engines/titanic/star_control/dvector.cpp
@@ -43,7 +43,7 @@ double DVector::getDistance(const DVector &src) {
 	return sqrt((src._x - _x) * (src._x - _x) + (src._y - _y) * (src._y - _y) + (src._z - _z) * (src._z - _z));
 }
 
-DVector DVector::DAffMatrixProdVec(const DAffine &m) {
+DVector DVector::dAffMatrixProdVec(const DAffine &m) {
 	DVector dest;
 	dest._x = m._col1._x * _x +
                   m._col2._x * _y +
@@ -63,9 +63,9 @@ DVector DVector::DAffMatrixProdVec(const DAffine &m) {
 	return dest;
 }
 
-void DVector::RotVectAxisY(double angle_deg) {
-	double sinVal = sin(angle_deg * Deg2Rad);
-	double cosVal = cos(angle_deg * Deg2Rad);
+void DVector::rotVectAxisY(double angleDeg) {
+	double sinVal = sin(angleDeg * Deg2Rad);
+	double cosVal = cos(angleDeg * Deg2Rad);
 	double x = cosVal * _x - sinVal * _z;
 	double z = cosVal * _z + sinVal * _x;
 
@@ -101,7 +101,7 @@ DAffine DVector::getFrameTransform(const DVector &v) {
 	return matrix4.compose(matrix3);
 }
 
-DAffine DVector::RotXY() const {
+DAffine DVector::rotXY() const {
 	DVector v1 = getAnglesAsVect();
 	DAffine m1, m2;
 	m1.setRotationMatrix(X_AXIS, v1._y * Rad2Deg);
diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h
index 7edb37f..eda69f9 100644
--- a/engines/titanic/star_control/dvector.h
+++ b/engines/titanic/star_control/dvector.h
@@ -50,35 +50,34 @@ public:
 
 	/**
 	 * Returns the matrix product with this vector and 
-         * also does a z translations
-	 * Doesn't change this vector
+	 * also does a z translations. Doesn't change this vector
 	 */
-	DVector DAffMatrixProdVec(const DAffine &m);
+	DVector dAffMatrixProdVec(const DAffine &m);
 
 	/**
 	 * Rotate this vector about the Y axis
 	 */
-	void RotVectAxisY(double angle_deg);
+	void rotVectAxisY(double angleDeg);
 
 	/**
-         * Returns a vector, v, that represents a magnitude, and two angles in radians
+	 * Returns a vector, v, that represents a magnitude, and two angles in radians
 	 * 1. Scale this vector to be unit magnitude and store scale in x component of v
-         * 2. X rotation angle from +y axis of this vector is put in y component of v
-         * 3. z component output of v is the 4-quadrant angle that z makes with x (Y axis rotation)
+	 * 2. X rotation angle from +y axis of this vector is put in y component of v
+	 * 3. z component output of v is the 4-quadrant angle that z makes with x (Y axis rotation)
 	 */
 	DVector getAnglesAsVect() const;
 
 	/**
-         * Returns a matrix that contains the frame rotation based on this vector and 
+	 * Returns a matrix that contains the frame rotation based on this vector and 
 	 * a vector rotation based on input vector v
 	 */
 	DAffine getFrameTransform(const DVector &v);
 
 	/**
-         * Returns a affine matrix that does a x then a y axis frame rotation
+	 * Returns a affine matrix that does a x then a y axis frame rotation
 	 * based on the orientation of this vector
 	 */
-	DAffine RotXY() const;
+	DAffine rotXY() const;
 
 	/**
 	 * Returns true if the passed vector equals this one
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index f8f6155..f172385 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -289,7 +289,7 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
 
 		tempV1 = _matrix._row2 - _matrix._row1;
 		diffV = tempV1;
-		m1 = diffV.RotXY();
+		m1 = diffV.rotXY();
 		m1 = m1.compose(subX);
 		subX = m1.inverseTransform();
 		subX = subX.compose(subY);
@@ -321,15 +321,15 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
 		tempV7._x = m3._row3._x * 1000000.0 + tempV3._x;
 
 		mrow3 = tempV8 = tempV7;
-		tempV3 = tempV3.DAffMatrixProdVec(subX);
-		mrow1 = mrow1.DAffMatrixProdVec(subX);
-		mrow2 = mrow2.DAffMatrixProdVec(subX);
-		mrow3 = mrow3.DAffMatrixProdVec(subX);
+		tempV3 = tempV3.dAffMatrixProdVec(subX);
+		mrow1 = mrow1.dAffMatrixProdVec(subX);
+		mrow2 = mrow2.dAffMatrixProdVec(subX);
+		mrow3 = mrow3.dAffMatrixProdVec(subX);
 
-		tempV3 = tempV3.DAffMatrixProdVec(m1);
-		mrow1 = mrow1.DAffMatrixProdVec(m1);
-		mrow2 = mrow2.DAffMatrixProdVec(m1);
-		mrow3 = mrow3.DAffMatrixProdVec(m1);
+		tempV3 = tempV3.dAffMatrixProdVec(m1);
+		mrow1 = mrow1.dAffMatrixProdVec(m1);
+		mrow2 = mrow2.dAffMatrixProdVec(m1);
+		mrow3 = mrow3.dAffMatrixProdVec(m1);
 
 		mrow1 -= tempV3;
 		mrow2 -= tempV3;
@@ -459,7 +459,7 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 
 	DAffine m2(X_AXIS, _matrix._row1);
 	DVector tempV1 = v - _matrix._row1;
-	DAffine m1 = tempV1.RotXY();
+	DAffine m1 = tempV1.rotXY();
 	m1 = m1.compose(m2);
 	m2 = m1.inverseTransform();
 	
@@ -497,11 +497,11 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 	tempV3._z = m5._row3._z * 1000000.0 + m4._col1._z;
 	m4._col4 = tempV3;
 
-	tempV2 = tempV2.DAffMatrixProdVec(m2);
-	m4._col1 = m4._col1.DAffMatrixProdVec(m2);
-	m4._col3 = m4._col3.DAffMatrixProdVec(m2);
-	m4._col2 = m4._col2.DAffMatrixProdVec(m2);
-	m4._col4 = m4._col4.DAffMatrixProdVec(m2);
+	tempV2 = tempV2.dAffMatrixProdVec(m2);
+	m4._col1 = m4._col1.dAffMatrixProdVec(m2);
+	m4._col3 = m4._col3.dAffMatrixProdVec(m2);
+	m4._col2 = m4._col2.dAffMatrixProdVec(m2);
+	m4._col4 = m4._col4.dAffMatrixProdVec(m2);
 
 	// Find the angle that gives the minimum distance
 	DVector tempPos;
@@ -509,7 +509,7 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 	int minDegree = 0;
 	for (int degree = 0; degree < 360; ++degree) {
 		tempPos = m4._col1;
-		tempPos.RotVectAxisY((double)degree);
+		tempPos.rotVectAxisY((double)degree);
 		double distance = tempV2.getDistance(tempPos);
 
 		if (distance < minDistance) {
@@ -518,14 +518,14 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 		}
 	}
 
-	m4._col1.RotVectAxisY((double)minDegree);
-	m4._col2.RotVectAxisY((double)minDegree);
-	m4._col3.RotVectAxisY((double)minDegree);
-	m4._col4.RotVectAxisY((double)minDegree);
-	m4._col1 = m4._col1.DAffMatrixProdVec(m1);
-	m4._col2 = m4._col2.DAffMatrixProdVec(m1);
-	m4._col3 = m4._col3.DAffMatrixProdVec(m1);
-	m4._col4 = m4._col4.DAffMatrixProdVec(m1);
+	m4._col1.rotVectAxisY((double)minDegree);
+	m4._col2.rotVectAxisY((double)minDegree);
+	m4._col3.rotVectAxisY((double)minDegree);
+	m4._col4.rotVectAxisY((double)minDegree);
+	m4._col1 = m4._col1.dAffMatrixProdVec(m1);
+	m4._col2 = m4._col2.dAffMatrixProdVec(m1);
+	m4._col3 = m4._col3.dAffMatrixProdVec(m1);
+	m4._col4 = m4._col4.dAffMatrixProdVec(m1);
 
 	m4._col3 -= m4._col1;
 	m4._col2 -= m4._col1;





More information about the Scummvm-git-logs mailing list