Browse Source

Clean up MSVC warning [C4305]: truncation from 'double' to 'F32'

suncaller 6 years ago
parent
commit
265e64f6fc

+ 1 - 1
Engine/source/math/mConstants.h

@@ -44,7 +44,7 @@
 
 
 #define M_CONST_E_F    2.7182818284590452353602874f
 #define M_CONST_E_F    2.7182818284590452353602874f
 
 
-#define POINT_EPSILON (1e-4) ///< Epsilon for point types.
+#define POINT_EPSILON (0.0001f) ///< Epsilon for point types.
 
 
 
 
 /// Result of an overlap test.
 /// Result of an overlap test.

+ 1 - 1
Engine/source/math/util/frustum.cpp

@@ -216,7 +216,7 @@ void Frustum::setNearFarDist( F32 nearDist, F32 farDist )
    // Recalculate the frustum.
    // Recalculate the frustum.
    MatrixF xfm( mTransform );
    MatrixF xfm( mTransform );
 
 
-   const F32 CENTER_EPSILON = 0.001;
+   const F32 CENTER_EPSILON = 0.001f;
    F32 centerX = mNearLeft + (mNearRight - mNearLeft) * 0.5;
    F32 centerX = mNearLeft + (mNearRight - mNearLeft) * 0.5;
    F32 centerY = mNearBottom + (mNearTop - mNearBottom) * 0.5;
    F32 centerY = mNearBottom + (mNearTop - mNearBottom) * 0.5;
    if ((centerX > CENTER_EPSILON || centerX < -CENTER_EPSILON) || (centerY > CENTER_EPSILON || centerY < -CENTER_EPSILON) )
    if ((centerX > CENTER_EPSILON || centerX < -CENTER_EPSILON) || (centerY > CENTER_EPSILON || centerY < -CENTER_EPSILON) )

+ 3 - 3
Engine/source/scene/sceneContainer.cpp

@@ -1392,7 +1392,7 @@ void SceneContainer::getBinRange( const F32 min, const F32 max, U32& minBin, U32
          // This is truly lame, but it can happen.  There must be a better way to
          // This is truly lame, but it can happen.  There must be a better way to
          //  deal with this.
          //  deal with this.
          if (minCoord == SceneContainer::csmTotalBinSize)
          if (minCoord == SceneContainer::csmTotalBinSize)
-            minCoord = SceneContainer::csmTotalBinSize - 0.01;
+            minCoord = SceneContainer::csmTotalBinSize - 0.01f;
       }
       }
 
 
       AssertFatal(minCoord >= 0.0 && minCoord < SceneContainer::csmTotalBinSize, "Bad minCoord");
       AssertFatal(minCoord >= 0.0 && minCoord < SceneContainer::csmTotalBinSize, "Bad minCoord");
@@ -1415,7 +1415,7 @@ void SceneContainer::getBinRange( const F32 min, const F32 max, U32& minBin, U32
          // This is truly lame, but it can happen.  There must be a better way to
          // This is truly lame, but it can happen.  There must be a better way to
          //  deal with this.
          //  deal with this.
          if (minCoord == SceneContainer::csmTotalBinSize)
          if (minCoord == SceneContainer::csmTotalBinSize)
-            minCoord = SceneContainer::csmTotalBinSize - 0.01;
+            minCoord = SceneContainer::csmTotalBinSize - 0.01f;
       }
       }
       AssertFatal(minCoord >= 0.0 && minCoord < SceneContainer::csmTotalBinSize, "Bad minCoord");
       AssertFatal(minCoord >= 0.0 && minCoord < SceneContainer::csmTotalBinSize, "Bad minCoord");
 
 
@@ -1426,7 +1426,7 @@ void SceneContainer::getBinRange( const F32 min, const F32 max, U32& minBin, U32
          // This is truly lame, but it can happen.  There must be a better way to
          // This is truly lame, but it can happen.  There must be a better way to
          //  deal with this.
          //  deal with this.
          if (maxCoord == SceneContainer::csmTotalBinSize)
          if (maxCoord == SceneContainer::csmTotalBinSize)
-            maxCoord = SceneContainer::csmTotalBinSize - 0.01;
+            maxCoord = SceneContainer::csmTotalBinSize - 0.01f;
       }
       }
       AssertFatal(maxCoord >= 0.0 && maxCoord < SceneContainer::csmTotalBinSize, "Bad maxCoord");
       AssertFatal(maxCoord >= 0.0 && maxCoord < SceneContainer::csmTotalBinSize, "Bad maxCoord");