@@ -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; | |||
} | |||
@@ -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); } | |||
@@ -957,7 +957,7 @@ static inline Quat<T> operator /(Quat<T> x, Quat<T> const &y) | |||
tprefix \ | |||
static inline tname<T> normalize(tname<T> const &val) \ | |||
{ \ | |||
T norm = len(val); \ | |||
T norm = (T)len(val); \ | |||
return norm ? val / norm : val * (T)0; \ | |||
} | |||
@@ -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); | |||
} | |||
} | |||
}; | |||
@@ -150,6 +150,7 @@ | |||
<ClCompile Include="..\src\entity.cpp" /> | |||
<ClCompile Include="..\src\font.cpp" /> | |||
<ClCompile Include="..\src\forge.cpp" /> | |||
<ClCompile Include="..\src\gpu\vbo.cpp" /> | |||
<ClCompile Include="..\src\gradient.cpp" /> | |||
<ClCompile Include="..\src\half.cpp" /> | |||
<ClCompile Include="..\src\hash.cpp" /> | |||
@@ -158,7 +159,6 @@ | |||
<ClCompile Include="..\src\layer.cpp" /> | |||
<ClCompile Include="..\src\log.cpp" /> | |||
<ClCompile Include="..\src\map.cpp" /> | |||
<ClCompile Include="..\src\matrix.cpp" /> | |||
<ClCompile Include="..\src\platform.cpp" /> | |||
<ClCompile Include="..\src\platform\sdl\sdlapp.cpp" /> | |||
<ClCompile Include="..\src\platform\sdl\sdlinput.cpp" /> | |||
@@ -175,6 +175,7 @@ | |||
<ClCompile Include="..\src\tileset.cpp" /> | |||
<ClCompile Include="..\src\timer.cpp" /> | |||
<ClCompile Include="..\src\trig.cpp" /> | |||
<ClCompile Include="..\src\vector.cpp" /> | |||
<ClCompile Include="..\src\video.cpp" /> | |||
<ClCompile Include="..\src\world.cpp" /> | |||
<ClCompile Include="..\src\worldentity.cpp" /> | |||
@@ -194,6 +195,7 @@ | |||
<ClInclude Include="..\src\entity.h" /> | |||
<ClInclude Include="..\src\font.h" /> | |||
<ClInclude Include="..\src\forge.h" /> | |||
<ClInclude Include="..\src\gpu\vbo.h" /> | |||
<ClInclude Include="..\src\gradient.h" /> | |||
<ClInclude Include="..\src\half.h" /> | |||
<ClInclude Include="..\src\hash.h" /> | |||
@@ -203,14 +205,16 @@ | |||
<ClInclude Include="..\src\log.h" /> | |||
<ClInclude Include="..\src\loldebug.h" /> | |||
<ClInclude Include="..\src\lolgl.h" /> | |||
<ClInclude Include="..\src\lol\math\real.h" /> | |||
<ClInclude Include="..\src\lol\math\remez.h" /> | |||
<ClInclude Include="..\src\lol\math\vector.h" /> | |||
<ClInclude Include="..\src\lol\unit.h" /> | |||
<ClInclude Include="..\src\map.h" /> | |||
<ClInclude Include="..\src\matrix.h" /> | |||
<ClInclude Include="..\src\numeric.h" /> | |||
<ClInclude Include="..\src\platform.h" /> | |||
<ClInclude Include="..\src\platform\sdl\sdlapp.h" /> | |||
<ClInclude Include="..\src\platform\sdl\sdlinput.h" /> | |||
<ClInclude Include="..\src\profiler.h" /> | |||
<ClInclude Include="..\src\real.h" /> | |||
<ClInclude Include="..\src\sample.h" /> | |||
<ClInclude Include="..\src\sampler.h" /> | |||
<ClInclude Include="..\src\scene.h" /> | |||
@@ -218,6 +222,8 @@ | |||
<ClInclude Include="..\src\simd.h" /> | |||
<ClInclude Include="..\src\sprite.h" /> | |||
<ClInclude Include="..\src\text.h" /> | |||
<ClInclude Include="..\src\thread\thread.h" /> | |||
<ClInclude Include="..\src\thread\threadbase.h" /> | |||
<ClInclude Include="..\src\ticker.h" /> | |||
<ClInclude Include="..\src\tiler.h" /> | |||
<ClInclude Include="..\src\tileset.h" /> | |||
@@ -230,4 +236,4 @@ | |||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |||
<ImportGroup Label="ExtensionTargets"> | |||
</ImportGroup> | |||
</Project> | |||
</Project> |
@@ -20,8 +20,47 @@ | |||
<Filter Include="src\platform\sdl"> | |||
<UniqueIdentifier>{4089421f-2cc2-4036-a6b2-9df8a2f4efc8}</UniqueIdentifier> | |||
</Filter> | |||
<Filter Include="src\lol"> | |||
<UniqueIdentifier>{0edcf1a5-3c9c-4425-918c-aa2cbebc51c1}</UniqueIdentifier> | |||
</Filter> | |||
<Filter Include="src\lol\math"> | |||
<UniqueIdentifier>{1e0b7a4c-425f-4d4f-945e-ba2ac9386ce0}</UniqueIdentifier> | |||
</Filter> | |||
<Filter Include="src\gpu"> | |||
<UniqueIdentifier>{ec9b94fc-c716-4ef2-9c3b-c7f3447574b0}</UniqueIdentifier> | |||
</Filter> | |||
<Filter Include="src\thread"> | |||
<UniqueIdentifier>{d31f75ec-73c8-4bda-9b8c-6d62a55bc30d}</UniqueIdentifier> | |||
</Filter> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClCompile Include="..\src\image\image.cpp"> | |||
<Filter>src\image</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\fps.cpp"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\quad.cpp"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\record.cpp"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\sphere.cpp"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\stats.cpp"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\shader\shader.cpp"> | |||
<Filter>src\shader</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\platform\sdl\sdlapp.cpp"> | |||
<Filter>src\platform\sdl</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\platform\sdl\sdlinput.cpp"> | |||
<Filter>src\platform\sdl</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\audio.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
@@ -64,15 +103,15 @@ | |||
<ClCompile Include="..\src\map.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\matrix.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\platform.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\profiler.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\real.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\sample.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
@@ -103,6 +142,9 @@ | |||
<ClCompile Include="..\src\trig.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\vector.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\video.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
@@ -112,38 +154,38 @@ | |||
<ClCompile Include="..\src\worldentity.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\image\image.cpp"> | |||
<Filter>src\image</Filter> | |||
<ClCompile Include="..\src\gpu\vbo.cpp"> | |||
<Filter>src\gpu</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\fps.cpp"> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClInclude Include="..\src\image\image.h"> | |||
<Filter>src\image</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\fps.h"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\quad.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\quad.h"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\record.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\record.h"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\sphere.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\sphere.h"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\debug\stats.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\stats.h"> | |||
<Filter>src\debug</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\shader\shader.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\shader\shader.h"> | |||
<Filter>src\shader</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\platform\sdl\sdlapp.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\platform\sdl\sdlinput.h"> | |||
<Filter>src\platform\sdl</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\platform\sdl\sdlinput.cpp"> | |||
</ClInclude> | |||
<ClInclude Include="..\src\platform\sdl\sdlapp.h"> | |||
<Filter>src\platform\sdl</Filter> | |||
</ClCompile> | |||
<ClCompile Include="..\src\real.cpp"> | |||
<Filter>src</Filter> | |||
</ClCompile> | |||
</ItemGroup> | |||
<ItemGroup> | |||
</ClInclude> | |||
<ClInclude Include="..\src\audio.h"> | |||
<Filter>src</Filter> | |||
</ClInclude> | |||
@@ -198,9 +240,6 @@ | |||
<ClInclude Include="..\src\map.h"> | |||
<Filter>src</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\matrix.h"> | |||
<Filter>src</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\numeric.h"> | |||
<Filter>src</Filter> | |||
</ClInclude> | |||
@@ -252,35 +291,26 @@ | |||
<ClInclude Include="..\src\worldentity.h"> | |||
<Filter>src</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\image\image.h"> | |||
<Filter>src\image</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\fps.h"> | |||
<Filter>src\debug</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\quad.h"> | |||
<Filter>src\debug</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\record.h"> | |||
<Filter>src\debug</Filter> | |||
<ClInclude Include="..\src\lol\math\real.h"> | |||
<Filter>src\lol\math</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\sphere.h"> | |||
<Filter>src\debug</Filter> | |||
<ClInclude Include="..\src\lol\math\remez.h"> | |||
<Filter>src\lol\math</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\debug\stats.h"> | |||
<Filter>src\debug</Filter> | |||
<ClInclude Include="..\src\lol\math\vector.h"> | |||
<Filter>src\lol\math</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\shader\shader.h"> | |||
<Filter>src\shader</Filter> | |||
<ClInclude Include="..\src\lol\unit.h"> | |||
<Filter>src\lol</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\platform\sdl\sdlinput.h"> | |||
<Filter>src\platform\sdl</Filter> | |||
<ClInclude Include="..\src\gpu\vbo.h"> | |||
<Filter>src\gpu</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\platform\sdl\sdlapp.h"> | |||
<Filter>src\platform\sdl</Filter> | |||
<ClInclude Include="..\src\thread\thread.h"> | |||
<Filter>src\thread</Filter> | |||
</ClInclude> | |||
<ClInclude Include="..\src\real.h"> | |||
<Filter>src</Filter> | |||
<ClInclude Include="..\src\thread\threadbase.h"> | |||
<Filter>src\thread</Filter> | |||
</ClInclude> | |||
</ItemGroup> | |||
</Project> |
@@ -19,12 +19,14 @@ | |||
</ProjectConfiguration> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClCompile Include="..\test\testsuite.cpp" /> | |||
<ClCompile Include="..\test\unit\build.cpp" /> | |||
<ClCompile Include="..\test\unit\cmplx.cpp" /> | |||
<ClCompile Include="..\test\unit\half.cpp" /> | |||
<ClCompile Include="..\test\unit\matrix.cpp" /> | |||
<ClCompile Include="..\test\unit\image.cpp" /> | |||
<ClCompile Include="..\test\unit\quat.cpp" /> | |||
<ClCompile Include="..\test\unit\real.cpp" /> | |||
<ClCompile Include="..\test\unit\trig.cpp" /> | |||
<ClCompile Include="..\test\unit\vector.cpp" /> | |||
</ItemGroup> | |||
<PropertyGroup Label="Globals"> | |||
<ProjectGuid>{80F81C11-8DA2-4990-91CB-9807783BA46E}</ProjectGuid> | |||
@@ -185,4 +187,4 @@ | |||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |||
<ImportGroup Label="ExtensionTargets"> | |||
</ImportGroup> | |||
</Project> | |||
</Project> |