diff --git a/Engine/source/core/color.h b/Engine/source/core/color.h index af111207c..b954b5de8 100644 --- a/Engine/source/core/color.h +++ b/Engine/source/core/color.h @@ -873,10 +873,10 @@ inline ColorI LinearColorF::toColorI(const bool keepAsLinear) float b = mPow(blue, gOneOverGamma); return ColorI(U8(r * 255.0f + 0.5), U8(g * 255.0f + 0.5), U8(b * 255.0f + 0.5), U8(alpha * 255.0f + 0.5)); #else - float r = red < 0.0031308f ? 12.92f * red : 1.055 * mPow(red, 1.0f / 2.4f) - 0.055f; - float g = green < 0.0031308f ? 12.92f * green : 1.055 * mPow(green, 1.0f / 2.4f) - 0.055f; - float b = blue < 0.0031308f ? 12.92f * blue : 1.055 * mPow(blue, 1.0f / 2.4f) - 0.055f; - return ColorI(U8(r * 255.0f + 0.5), U8(g * 255.0f + 0.5), U8(b * 255.0f + 0.5), U8(alpha * 255.0f + 0.5)); + float r = red < 0.0031308f ? 12.92f * red : 1.055f * mPow(red, 1.0f / 2.4f) - 0.055f; + float g = green < 0.0031308f ? 12.92f * green : 1.055f * mPow(green, 1.0f / 2.4f) - 0.055f; + float b = blue < 0.0031308f ? 12.92f * blue : 1.055f * mPow(blue, 1.0f / 2.4f) - 0.055f; + return ColorI(U8(r * 255.0f + 0.5f), U8(g * 255.0f + 0.5f), U8(b * 255.0f + 0.5f), U8(alpha * 255.0f + 0.5f)); #endif } } diff --git a/Engine/source/math/mMathFn.h b/Engine/source/math/mMathFn.h index 92d139ae5..a6668cc53 100644 --- a/Engine/source/math/mMathFn.h +++ b/Engine/source/math/mMathFn.h @@ -209,7 +209,7 @@ inline F32 mFmod(const F32 val, const F32 mod) inline S32 mRound(const F32 val) { - return (S32)floor(F64(val + 0.5f)); + return (S32)floor(val + 0.5f); } inline F32 mRound(const F32 val, const S32 n) diff --git a/Engine/source/math/mPoint2.h b/Engine/source/math/mPoint2.h index 851f2aeb0..6019bf92e 100644 --- a/Engine/source/math/mPoint2.h +++ b/Engine/source/math/mPoint2.h @@ -915,7 +915,7 @@ inline bool mIsNaN( const Point2F &p ) /// Return negative if p0p1p2 are clockwise inline F64 mCross(const Point2F &p0, const Point2F &p1, const Point2F &pt2) { - return F64(p1.x - p0.x) * F64(pt2.y - p0.y) - F64(p1.y - p0.y) * F64(pt2.x - p0.x); + return F64((p1.x - p0.x) * (pt2.y - p0.y) - (p1.y - p0.y) * (pt2.x - p0.x)); } diff --git a/Engine/source/terrain/terrFile.h b/Engine/source/terrain/terrFile.h index e6ac593f0..568184aac 100644 --- a/Engine/source/terrain/terrFile.h +++ b/Engine/source/terrain/terrFile.h @@ -201,7 +201,7 @@ inline TerrainSquare* TerrainFile::findSquare( U32 level, U32 x, U32 y ) const x >>= level; y >>= level; - return mGridMap[level] + x + ( y << ( mGridLevels - level ) ); + return mGridMap[level] + x + U64( y << U32( mGridLevels - level ) ); } inline void TerrainFile::setHeight( U32 x, U32 y, U16 height ) diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 2c5335784..8cfe1a4dd 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -527,7 +527,7 @@ public: { if ((index >= 0) && (index < size())) { if (source->getFloat_array()) - return &source->getFloat_array()->getValue()[index*stride()]; + return &source->getFloat_array()->getValue()[(U64)(index*stride())]; } return 0; } @@ -541,9 +541,9 @@ public: if ((index >= 0) && (index < size())) { // could be plain strings or IDREFs if (source->getName_array()) - return source->getName_array()->getValue()[index*stride()]; + return source->getName_array()->getValue()[(U64)(index*stride())]; else if (source->getIDREF_array()) - return source->getIDREF_array()->getValue()[index*stride()].getID(); + return source->getIDREF_array()->getValue()[(U64)(index*stride())].getID(); } return ""; } @@ -708,7 +708,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTrian continue; domUint* pSrcData = &(P->getValue()[0]); - size_t numTriangles = (P->getValue().getCount() / stride) - 2; + U64 numTriangles = (P->getValue().getCount() / stride) - 2; // Convert the strip back to a triangle list domUint* v0 = pSrcData; @@ -723,7 +723,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTrian else { // CCW triangle - pTriangleData->appendArray(stride*3, v0); + pTriangleData->appendArray((U64)(stride*3), v0); } } } @@ -749,7 +749,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriangl continue; domUint* pSrcData = &(P->getValue()[0]); - size_t numTriangles = (P->getValue().getCount() / stride) - 2; + U64 numTriangles = (P->getValue().getCount() / stride) - 2; // Convert the fan back to a triangle list domUint* v0 = pSrcData + stride; @@ -781,7 +781,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriang continue; domUint* pSrcData = &(P->getValue()[0]); - size_t numPoints = P->getValue().getCount() / stride; + U64 numPoints = P->getValue().getCount() / stride; // Use a simple tri-fan (centered at the first point) method of // converting the polygon to triangles. @@ -789,7 +789,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriang pSrcData += stride; for (S32 iTri = 0; iTri < numPoints-2; iTri++) { pTriangleData->appendArray(stride, v0); - pTriangleData->appendArray(stride*2, pSrcData); + pTriangleData->appendArray((U64)(stride*2), pSrcData); pSrcData += stride; } }