diff --git a/src/debug/sphere.cpp b/src/debug/sphere.cpp index 398a86ec..882717b1 100644 --- a/src/debug/sphere.cpp +++ b/src/debug/sphere.cpp @@ -76,7 +76,7 @@ class DebugSphereData void Normalize(GLfloat *a) { - GLfloat d = 1.0f / sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); + GLfloat d = 1.0f / std::sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); a[0] *= d; a[1] *= d; a[2] *= d; } diff --git a/src/half.h b/src/half.h index a3908017..8d1cb6ae 100644 --- a/src/half.h +++ b/src/half.h @@ -28,9 +28,9 @@ public: /* Constructors. Always inline so that the code can work in registers * instead of calling routines with the hidden "this" parameter. */ inline half() { } - inline half(int f) { *this = makefast(f); } + inline half(int f) { *this = makefast((float)f); } inline half(float f) { *this = makefast(f); } - inline half(double f) { *this = makefast(f); } + inline half(double f) { *this = makefast((float)f); } inline int is_nan() const { @@ -53,9 +53,9 @@ public: } /* Cast to other types -- always inline, see constructors */ - inline half &operator =(int f) { return *this = makefast(f); } + inline half &operator =(int f) { return *this = makefast((float)f); } inline half &operator =(float f) { return *this = makefast(f); } - inline half &operator =(double f) { return *this = makefast(f); } + inline half &operator =(double f) { return *this = makefast((float)f); } inline operator int() const { return (int)tofloat(*this); } inline operator float() const { return tofloat(*this); } diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 1244140a..885bb903 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -957,7 +957,7 @@ static inline Quat operator /(Quat x, Quat const &y) tprefix \ static inline tname normalize(tname const &val) \ { \ - T norm = len(val); \ + T norm = (T)len(val); \ return norm ? val / norm : val * (T)0; \ } diff --git a/test/unit/trig.cpp b/test/unit/trig.cpp index 2a80317c..846549cd 100644 --- a/test/unit/trig.cpp +++ b/test/unit/trig.cpp @@ -34,7 +34,7 @@ LOLUNIT_FIXTURE(TrigTest) #endif double b = lol_sin(f); LOLUNIT_SET_CONTEXT(f); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(f) * 1e-11); } for (int i = -10000; i < 10000; i++) @@ -47,7 +47,7 @@ LOLUNIT_FIXTURE(TrigTest) #endif double b = lol_sin(f); LOLUNIT_SET_CONTEXT(f); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(f) * 1e-11); } } @@ -63,7 +63,7 @@ LOLUNIT_FIXTURE(TrigTest) #endif double b = lol_cos(f); LOLUNIT_SET_CONTEXT(f); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(f) * 1e-11); } for (int i = -10000; i < 10000; i++) @@ -76,7 +76,7 @@ LOLUNIT_FIXTURE(TrigTest) #endif double b = lol_cos(f); LOLUNIT_SET_CONTEXT(f); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(f) * 1e-11); } } @@ -95,8 +95,8 @@ LOLUNIT_FIXTURE(TrigTest) double b1, b2; lol_sincos(f, &b1, &b2); LOLUNIT_SET_CONTEXT(f); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, fabs(f) * 1e-11); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, std::fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, std::fabs(f) * 1e-11); } for (int i = -10000; i < 10000; i++) @@ -112,8 +112,8 @@ LOLUNIT_FIXTURE(TrigTest) double b1, b2; lol_sincos(f, &b1, &b2); LOLUNIT_SET_CONTEXT(f); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, fabs(f) * 1e-11); - LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a1, b1, std::fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a2, b2, std::fabs(f) * 1e-11); } } @@ -129,12 +129,12 @@ LOLUNIT_FIXTURE(TrigTest) #endif double b = lol_tan(f); LOLUNIT_SET_CONTEXT(f); - if (fabs(a) > 1e4) - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * fabs(a) * 1e-11); - else if (fabs(a) > 1.0) - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * 1e-11); + if (std::fabs(a) > 1e4) + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(a) * std::fabs(a) * 1e-11); + else if (std::fabs(a) > 1.0) + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(a) * 1e-11); else - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(f) * 1e-11); } for (int i = -10000; i < 10000; i++) @@ -147,12 +147,12 @@ LOLUNIT_FIXTURE(TrigTest) #endif double b = lol_tan(f); LOLUNIT_SET_CONTEXT(f); - if (fabs(a) > 1e4) - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * fabs(a) * 1e-11); - else if (fabs(a) > 1.0) - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(a) * 1e-11); + if (std::fabs(a) > 1e4) + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(a) * std::fabs(a) * 1e-11); + else if (std::fabs(a) > 1.0) + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(a) * 1e-11); else - LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, fabs(f) * 1e-11); + LOLUNIT_ASSERT_DOUBLES_EQUAL(a, b, std::fabs(f) * 1e-11); } } }; diff --git a/win32/lolcore.vcxproj b/win32/lolcore.vcxproj index 9f532049..3d60c6f2 100644 --- a/win32/lolcore.vcxproj +++ b/win32/lolcore.vcxproj @@ -150,6 +150,7 @@ + @@ -158,7 +159,6 @@ - @@ -175,6 +175,7 @@ + @@ -194,6 +195,7 @@ + @@ -203,14 +205,16 @@ + + + + - - @@ -218,6 +222,8 @@ + + @@ -230,4 +236,4 @@ - + \ No newline at end of file diff --git a/win32/lolcore.vcxproj.filters b/win32/lolcore.vcxproj.filters index 11cbea42..11380a07 100644 --- a/win32/lolcore.vcxproj.filters +++ b/win32/lolcore.vcxproj.filters @@ -20,8 +20,47 @@ {4089421f-2cc2-4036-a6b2-9df8a2f4efc8} + + {0edcf1a5-3c9c-4425-918c-aa2cbebc51c1} + + + {1e0b7a4c-425f-4d4f-945e-ba2ac9386ce0} + + + {ec9b94fc-c716-4ef2-9c3b-c7f3447574b0} + + + {d31f75ec-73c8-4bda-9b8c-6d62a55bc30d} + + + src\image + + + src\debug + + + src\debug + + + src\debug + + + src\debug + + + src\debug + + + src\shader + + + src\platform\sdl + + + src\platform\sdl + src @@ -64,15 +103,15 @@ src - - src - src src + + src + src @@ -103,6 +142,9 @@ src + + src + src @@ -112,38 +154,38 @@ src - - src\image + + src\gpu - + + + + src\image + + src\debug - - + + src\debug - - + + src\debug - - + + src\debug - - + + src\debug - - + + src\shader - - + + src\platform\sdl - - + + src\platform\sdl - - - src - - - + src @@ -198,9 +240,6 @@ src - - src - src @@ -252,35 +291,26 @@ src - - src\image - - - src\debug - - - src\debug - - - src\debug + + src\lol\math - - src\debug + + src\lol\math - - src\debug + + src\lol\math - - src\shader + + src\lol - - src\platform\sdl + + src\gpu - - src\platform\sdl + + src\thread - - src + + src\thread \ No newline at end of file diff --git a/win32/testsuite.vcxproj b/win32/testsuite.vcxproj index 790cf6ff..d3258cf2 100644 --- a/win32/testsuite.vcxproj +++ b/win32/testsuite.vcxproj @@ -19,12 +19,14 @@ - + - + + + {80F81C11-8DA2-4990-91CB-9807783BA46E} @@ -185,4 +187,4 @@ - + \ No newline at end of file