[Bf-blender-cvs] [0dcca69] master: Moto Clean-up: double-promotion warnings

Jorge Bernal noreply at git.blender.org
Sun Dec 13 02:58:22 CET 2015


Commit: 0dcca6958913093948006d389ef9a777755db0f8
Author: Jorge Bernal
Date:   Sun Dec 13 02:50:30 2015 +0100
Branches: master
https://developer.blender.org/rB0dcca6958913093948006d389ef9a777755db0f8

Moto Clean-up: double-promotion warnings

===================================================================

M	intern/moto/include/MT_Matrix3x3.h
M	intern/moto/include/MT_Matrix3x3.inl
M	intern/moto/include/MT_Matrix4x4.h
M	intern/moto/include/MT_Matrix4x4.inl
M	intern/moto/include/MT_Quaternion.h
M	intern/moto/include/MT_Quaternion.inl
M	intern/moto/include/MT_Scalar.h
M	intern/moto/include/MT_Vector2.inl
M	intern/moto/include/MT_Vector3.inl
M	intern/moto/include/MT_Vector4.inl
M	intern/moto/intern/MT_CmMatrix4x4.cpp
M	intern/moto/intern/MT_Transform.cpp

===================================================================

diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h
index 17dd533..8832fd5 100644
--- a/intern/moto/include/MT_Matrix3x3.h
+++ b/intern/moto/include/MT_Matrix3x3.h
@@ -132,14 +132,14 @@ public:
     void setRotation(const MT_Quaternion& q) {
         MT_Scalar d = q.length2();
         MT_assert(!MT_fuzzyZero2(d));
-        MT_Scalar s = MT_Scalar(2.0) / d;
+        MT_Scalar s = MT_Scalar(2.0f) / d;
         MT_Scalar xs = q[0] * s,   ys = q[1] * s,   zs = q[2] * s;
         MT_Scalar wx = q[3] * xs,  wy = q[3] * ys,  wz = q[3] * zs;
         MT_Scalar xx = q[0] * xs,  xy = q[0] * ys,  xz = q[0] * zs;
         MT_Scalar yy = q[1] * ys,  yz = q[1] * zs,  zz = q[2] * zs;
-        setValue(MT_Scalar(1.0) - (yy + zz), xy - wz        ,         xz + wy,
-                 xy + wz        , MT_Scalar(1.0) - (xx + zz),         yz - wx,
-                 xz - wy        , yz + wx,         MT_Scalar(1.0) - (xx + yy));
+        setValue(MT_Scalar(1.0f) - (yy + zz), xy - wz        ,         xz + wy,
+                 xy + wz        , MT_Scalar(1.0f) - (xx + zz),         yz - wx,
+                 xz - wy        , yz + wx,         MT_Scalar(1.0f) - (xx + yy));
     }
     
 	/**
@@ -169,19 +169,19 @@ public:
 
 	void getEuler(MT_Scalar& yaw, MT_Scalar& pitch, MT_Scalar& roll) const
 		{			
-			if (m_el[2][0] != -1.0 && m_el[2][0] != 1.0) {
+			if (m_el[2][0] != -1.0f && m_el[2][0] != 1.0f) {
 				pitch = MT_Scalar(-asin(m_el[2][0]));
 				yaw = MT_Scalar(atan2(m_el[2][1] / cos(pitch), m_el[2][2] / cos(pitch)));
 				roll = MT_Scalar(atan2(m_el[1][0] / cos(pitch), m_el[0][0] / cos(pitch)));				
 			}
 			else {
 				roll = MT_Scalar(0);
-				if (m_el[2][0] == -1.0) {
-					pitch = MT_PI / 2.0;
+				if (m_el[2][0] == -1.0f) {
+					pitch = (float)MT_PI / 2.0f;
 					yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
 				}
 				else {
-					pitch = - MT_PI / 2.0;
+					pitch = (float)-MT_PI / 2.0f;
 					yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
 				}
 			}
@@ -200,15 +200,15 @@ public:
     }
     
     void setIdentity() { 
-        setValue(MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0), 
-                 MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0), 
-                 MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0)); 
+        setValue(MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), 
+                 MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f), 
+                 MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f)); 
     }
     
     void getValue(float *m) const {
-        *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0]; *m++ = (float) 0.0;
-        *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1]; *m++ = (float) 0.0;
-        *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2]; *m   = (float) 0.0;
+        *m++ = (float) m_el[0][0]; *m++ = (float) m_el[1][0]; *m++ = (float) m_el[2][0]; *m++ = (float) 0.0f;
+        *m++ = (float) m_el[0][1]; *m++ = (float) m_el[1][1]; *m++ = (float) m_el[2][1]; *m++ = (float) 0.0f;
+        *m++ = (float) m_el[0][2]; *m++ = (float) m_el[1][2]; *m++ = (float) m_el[2][2]; *m   = (float) 0.0f;
     }
 
     void getValue(double *m) const {
diff --git a/intern/moto/include/MT_Matrix3x3.inl b/intern/moto/include/MT_Matrix3x3.inl
index c581640..088c4b0 100644
--- a/intern/moto/include/MT_Matrix3x3.inl
+++ b/intern/moto/include/MT_Matrix3x3.inl
@@ -7,11 +7,11 @@ GEN_INLINE MT_Quaternion MT_Matrix3x3::getRotation() const {
    
     MT_Scalar trace = m_el[0][0] + m_el[1][1] + m_el[2][2];
     
-    if (trace > 0.0) 
+    if (trace > 0.0f) 
     {
-        MT_Scalar s = sqrt(trace + MT_Scalar(1.0));
-        result[3] = s * MT_Scalar(0.5);
-        s = MT_Scalar(0.5) / s;
+        MT_Scalar s = sqrt(trace + MT_Scalar(1.0f));
+        result[3] = s * MT_Scalar(0.5f);
+        s = MT_Scalar(0.5f) / s;
         
         result[0] = (m_el[2][1] - m_el[1][2]) * s;
         result[1] = (m_el[0][2] - m_el[2][0]) * s;
@@ -28,11 +28,11 @@ GEN_INLINE MT_Quaternion MT_Matrix3x3::getRotation() const {
         int j = next[i];  
         int k = next[j];
         
-        MT_Scalar s = sqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + MT_Scalar(1.0));
+        MT_Scalar s = sqrt(m_el[i][i] - m_el[j][j] - m_el[k][k] + MT_Scalar(1.0f));
         
-        result[i] = s * MT_Scalar(0.5);
+        result[i] = s * MT_Scalar(0.5f);
         
-        s = MT_Scalar(0.5) / s;
+        s = MT_Scalar(0.5f) / s;
         
         result[3] = (m_el[k][j] - m_el[j][k]) * s;
         result[j] = (m_el[j][i] + m_el[i][j]) * s;
@@ -80,7 +80,7 @@ GEN_INLINE MT_Matrix3x3 MT_Matrix3x3::inverse() const {
     MT_Vector3 co(cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1));
     MT_Scalar det = MT_dot((*this)[0], co);
     MT_assert(!MT_fuzzyZero2(det));
-    MT_Scalar s = MT_Scalar(1.0) / det;
+    MT_Scalar s = MT_Scalar(1.0f) / det;
     return 
         MT_Matrix3x3(co[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s,
                      co[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s,
diff --git a/intern/moto/include/MT_Matrix4x4.h b/intern/moto/include/MT_Matrix4x4.h
index de2ea99..045cc3b 100644
--- a/intern/moto/include/MT_Matrix4x4.h
+++ b/intern/moto/include/MT_Matrix4x4.h
@@ -86,7 +86,7 @@ public:
 			basis[0][0],basis[0][1],basis[0][2],origin[0],
 			basis[1][0],basis[1][1],basis[1][2],origin[1],
 			basis[2][0],basis[2][1],basis[2][2],origin[2],
-			MT_Scalar(0),MT_Scalar(0),MT_Scalar(0),MT_Scalar(1)
+			MT_Scalar(0.0f),MT_Scalar(0.0f),MT_Scalar(0.0f),MT_Scalar(1.0f)
 		);
 	}
 		
@@ -157,10 +157,10 @@ public:
 	 * Set this matrix to I.
 	 */
     void setIdentity() { 
-        setValue(MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0),
-                 MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0), MT_Scalar(0.0),
-                 MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0),
-			     MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0)); 
+        setValue(MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(0.0f),
+                 MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f), MT_Scalar(0.0f),
+                 MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f),
+			     MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f)); 
     }
 
 	/**
diff --git a/intern/moto/include/MT_Matrix4x4.inl b/intern/moto/include/MT_Matrix4x4.inl
index 074bd6e..fb72af1 100644
--- a/intern/moto/include/MT_Matrix4x4.inl
+++ b/intern/moto/include/MT_Matrix4x4.inl
@@ -11,14 +11,14 @@ GEN_INLINE void MT_Matrix4x4::invert()  {
 	for (i=1; i < 4; i++) m_el[0][i] /= m_el[0][0];
 	for (i=1; i < 4; i++)  { 
 		for (j=i; j < 4; j++)  { // do a column of L
-			MT_Scalar sum = 0.0;
+			MT_Scalar sum = 0.0f;
 			for (k = 0; k < i; k++)  
 				sum += m_el[j][k] * m_el[k][i];
 			m_el[j][i] -= sum;
 		}
 		if (i == 3) continue;
 		for (j=i+1; j < 4; j++)  {  // do a row of U
-			MT_Scalar sum = 0.0;
+			MT_Scalar sum = 0.0f;
 			for (k = 0; k < i; k++)
 				sum += m_el[i][k]*m_el[k][j];
 			m_el[i][j] = 
@@ -27,9 +27,9 @@ GEN_INLINE void MT_Matrix4x4::invert()  {
 	}
 	for (i = 0; i < 4; i++ )  // invert L
 		for (j = i; j < 4; j++ )  {
-			MT_Scalar x = 1.0;
+			MT_Scalar x = 1.0f;
 			if ( i != j ) {
-				x = 0.0;
+				x = 0.0f;
 				for (k = i; k < j; k++ ) 
 					x -= m_el[j][k]*m_el[k][i];
 			}
@@ -38,16 +38,16 @@ GEN_INLINE void MT_Matrix4x4::invert()  {
 	for (i = 0; i < 4; i++ )   // invert U
 		for (j = i; j < 4; j++ )  {
 			if ( i == j ) continue;
-			MT_Scalar sum = 0.0;
+			MT_Scalar sum = 0.0f;
 			for (k = i; k < j; k++ )
-				sum += m_el[k][j]*( (i==k) ? 1.0 : m_el[i][k] );
+				sum += m_el[k][j]*( (i==k) ? 1.0f : m_el[i][k] );
 			m_el[i][j] = -sum;
 		}
 	for (i = 0; i < 4; i++ )   // final inversion
 		for (j = 0; j < 4; j++ )  {
-			MT_Scalar sum = 0.0;
+			MT_Scalar sum = 0.0f;
 			for (k = ((i>j)?i:j); k < 4; k++ )  
-				sum += ((j==k)?1.0:m_el[j][k])*m_el[k][i];
+				sum += ((j==k)?1.0f:m_el[j][k])*m_el[k][i];
 			m_el[j][i] = sum;
 		}
 }
diff --git a/intern/moto/include/MT_Quaternion.h b/intern/moto/include/MT_Quaternion.h
index 407d2913..b7703fe 100644
--- a/intern/moto/include/MT_Quaternion.h
+++ b/intern/moto/include/MT_Quaternion.h
@@ -70,18 +70,18 @@ public:
     void setRotation(const MT_Vector3& axis, MT_Scalar mt_angle) {
         MT_Scalar d = axis.length();
         MT_assert(!MT_fuzzyZero(d));
-        MT_Scalar s = sin(mt_angle * MT_Scalar(0.5)) / d;
+        MT_Scalar s = sin(mt_angle * MT_Scalar(0.5f)) / d;
         setValue(axis[0] * s, axis[1] * s, axis[2] * s, 
-                 cos(mt_angle * MT_Scalar(0.5)));
+                 cos(mt_angle * MT_Scalar(0.5f)));
     }
 
     void setEuler(MT_Scalar yaw, MT_Scalar pitch, MT_Scalar roll) {
-        MT_Scalar cosYaw = cos(yaw * MT_Scalar(0.5));
-        MT_Scalar sinYaw = sin(yaw * MT_Scalar(0.5));
-        MT_Scalar cosPitch = cos(pitch * MT_Scalar(0.5));
-        MT_Scalar sinPitch = sin(pitch * MT_Scalar(0.5));
-        MT_Scalar cosRoll = cos(roll * MT_Scalar(0.5));
-        MT_Scalar sinRoll = sin(roll * MT_Scalar(0.5));
+        MT_Scalar cosYaw = cos(yaw * MT_Scalar(0.5f));
+        MT_Scalar sinYaw = sin(yaw * MT_Scalar(0.5f));
+        MT_Scalar cosPitch = cos(pitch * MT_Scalar(0.5f));
+        MT_Scalar sinPitch = sin(pitch * MT_Scalar(0.5f));
+        MT_Scalar cosRoll = cos(roll * MT_Scalar(0.5f));
+        MT_Scalar sinRoll = sin(roll * MT_Scalar(0.5f));
         setValue(cosRoll * sinPitch * cosYaw + sinRoll * cosPitch * sinYaw,
                  cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw,
                  sinRoll * cosPitch * cosYaw - cosRoll * sinPitch * sinYaw,
diff --git a/intern/moto/include/MT_Quaternion.inl b/intern/moto/include/MT_Quaternion.inl
index ec747c4..dcd9910 100644
--- a/intern/moto/include/MT_Quaternion.inl
+++ b/intern/moto/include/MT_Quaternion.inl
@@ -29,8 +29,8 @@ GEN_INLINE MT_Quaternion MT_Quaternion::inverse() const {
 //       pg. 124-132
 GEN_INLINE MT_Quaternion MT_Quaternion::random() {
     MT_Scalar x0 = MT_random();
-    MT_Scalar r1 = sqrt(MT_Scalar(1.0) - x0), r2 = sqrt(x0);
-    MT_Scal

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list