From e1206568ec71c0e7017c1f764fdc146ba86ce30a Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:22:04 -0700 Subject: Revert "Globals.h: Added Floor and Ciel casting, C++ cast cleanups, etc" This reverts commit 472efa8174626a00ffdf5b39e1a44ac419cd3698. Apparently we don't support some of these features quite yet (darn you C++98!) --- src/Vector3.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/Vector3.h') diff --git a/src/Vector3.h b/src/Vector3.h index 782b0d1c9..1dcb38f64 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -4,6 +4,7 @@ #define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC) +#include #include #include @@ -28,9 +29,9 @@ public: // Hardcoded copy constructors (tolua++ does not support function templates .. yet) - Vector3(const Vector3 & a_Rhs) : x(static_cast(a_Rhs.x)), y(static_cast(a_Rhs.y)), z(static_cast(a_Rhs.z)) {} - Vector3(const Vector3 & a_Rhs) : x(static_cast(a_Rhs.x)), y(static_cast(a_Rhs.y)), z(static_cast(a_Rhs.z)) {} - Vector3(const Vector3 & a_Rhs) : x(static_cast(a_Rhs.x)), y(static_cast(a_Rhs.y)), z(static_cast(a_Rhs.z)) {} + Vector3(const Vector3 & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {} + Vector3(const Vector3 & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {} + Vector3(const Vector3 & a_Rhs) : x((T) a_Rhs.x), y((T) a_Rhs.y), z((T) a_Rhs.z) {} // tolua_end @@ -52,9 +53,9 @@ public: { double Len = 1.0 / Length(); - x = static_cast(x * Len); - y = static_cast(y * Len); - z = static_cast(z * Len); + x = (T)(x * Len); + y = (T)(y * Len); + z = (T)(z * Len); } inline Vector3 NormalizeCopy(void) const @@ -62,9 +63,9 @@ public: double Len = 1.0 / Length(); return Vector3( - static_cast(x * Len), - static_cast(y * Len), - static_cast(z * Len) + (T)(x * Len), + (T)(y * Len), + (T)(z * Len) ); } @@ -73,15 +74,15 @@ public: double Len = 1.0 / Length(); a_Rhs.Set( - static_cast(x * Len), - static_cast(y * Len), - static_cast(z * Len) + (T)(x * Len), + (T)(y * Len), + (T)(z * Len) ); } inline double Length(void) const { - return sqrt(static_cast(x * x + y * y + z * z)); + return sqrt((double)(x * x + y * y + z * z)); } inline double SqrLength(void) const @@ -137,9 +138,9 @@ public: inline Vector3 Floor(void) const { return Vector3( - static_cast(floor(x)), - static_cast(floor(y)), - static_cast(floor(z)) + (int)floor(x), + (int)floor(y), + (int)floor(z) ); } -- cgit v1.2.3