diff --git a/Source/Engine/Core/Utilities.h b/Source/Engine/Core/Utilities.h index 8d77c508d..531509d61 100644 --- a/Source/Engine/Core/Utilities.h +++ b/Source/Engine/Core/Utilities.h @@ -11,21 +11,21 @@ namespace Utilities template FORCE_INLINE T RoundTo1DecimalPlace(T value) { - return round(value * 10) / 10; + return (T)round((double)value * 10) / (T)10; } // Round floating point value up to 2 decimal places template FORCE_INLINE T RoundTo2DecimalPlaces(T value) { - return round(value * 100) / 100; + return (T)round((double)value * 100.0) / (T)100; } // Round floating point value up to 3 decimal places template FORCE_INLINE T RoundTo3DecimalPlaces(T value) { - return round(value * 1000) / 1000; + return (T)round((double)value * 1000.0) / (T)1000; } // Converts size of the file (in bytes) to the best fitting string diff --git a/Source/Engine/Debug/DebugDraw.cpp b/Source/Engine/Debug/DebugDraw.cpp index e394b31f4..bae424c4e 100644 --- a/Source/Engine/Debug/DebugDraw.cpp +++ b/Source/Engine/Debug/DebugDraw.cpp @@ -313,10 +313,10 @@ bool DebugDrawService::Init() for (float a = 0.0f; a < TWO_PI; a += step) { // Calculate sines and cosines - float sinA = sin(a); - float cosA = cos(a); - float sinB = sin(a + step); - float cosB = cos(a + step); + float sinA = Math::Sin(a); + float cosA = Math::Cos(a); + float sinB = Math::Sin(a + step); + float cosB = Math::Cos(a + step); // XY loop SphereCache[index++] = Vector3(cosA, sinA, 0.0f); @@ -337,10 +337,10 @@ bool DebugDrawService::Init() for (float a = 0.0f; a < TWO_PI; a += step) { // Calculate sines and cosines - float sinA = sin(a); - float cosA = cos(a); - float sinB = sin(a + step); - float cosB = cos(a + step); + float sinA = Math::Sin(a); + float cosA = Math::Cos(a); + float sinB = Math::Sin(a + step); + float cosB = Math::Cos(a + step); CircleCache[index++] = Vector3(cosA, sinA, 0.0f); CircleCache[index++] = Vector3(cosB, sinB, 0.0f); @@ -1049,10 +1049,10 @@ void DebugDraw::DrawWireTube(const Vector3& position, const Quaternion& orientat { // Calculate sines and cosines // TODO: optimize this stuff - float sinA = sin(a) * radius; - float cosA = cos(a) * radius; - float sinB = sin(a + step) * radius; - float cosB = cos(a + step) * radius; + float sinA = Math::Sin(a) * radius; + float cosA = Math::Cos(a) * radius; + float sinB = Math::Sin(a + step) * radius; + float cosB = Math::Cos(a + step) * radius; // First XY loop DRAW_WIRE_BOX_LINE(cosA, sinA, -halfLength, cosB, sinB, -halfLength); @@ -1098,8 +1098,8 @@ void DebugDraw::DrawWireCylinder(const Vector3& position, const Quaternion& orie { // Cache data float theta = i * angleBetweenFacets; - float x = cos(theta) * radius; - float z = sin(theta) * radius; + float x = Math::Cos(theta) * radius; + float z = Math::Sin(theta) * radius; // Top cap CylinderCache[index++] = Vector3(x, verticalOffset, z); diff --git a/Source/Engine/Level/Actors/SpotLight.cpp b/Source/Engine/Level/Actors/SpotLight.cpp index 57d4d97f3..c601506c4 100644 --- a/Source/Engine/Level/Actors/SpotLight.cpp +++ b/Source/Engine/Level/Actors/SpotLight.cpp @@ -198,8 +198,8 @@ void SpotLight::OnDebugDrawSelected() Vector3 up = _transform.GetUp(); Vector3 forward = GetDirection(); float radius = GetScaledRadius(); - float discRadius = radius * tan(_outerConeAngle * DegreesToRadians); - float falloffDiscRadius = radius * tan(_innerConeAngle * DegreesToRadians); + float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians); + float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians); Vector3 position = GetPosition(); DEBUG_DRAW_LINE(position, position + forward * radius + up * discRadius, color, 0, true);