diff --git a/src/Makefile.am b/src/Makefile.am index 0a4f5f43..7fb4b03b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ liblol_a_SOURCES = \ \ lol/unit.h lol/debug.h \ lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \ - lol/math/trig.h \ + lol/math/math.h \ \ generated/location.hh generated/position.hh generated/stack.hh \ \ diff --git a/src/audio.cpp b/src/audio.cpp index 1882e68e..8ef51806 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #if defined USE_SDL_MIXER # include # include diff --git a/src/core.h b/src/core.h index b5a881bf..7985b457 100644 --- a/src/core.h +++ b/src/core.h @@ -68,10 +68,10 @@ static inline int isnan(float f) // Base types #include "lol/debug.h" +#include "lol/math/math.h" #include "lol/math/half.h" #include "lol/math/real.h" #include "lol/math/vector.h" -#include "lol/math/trig.h" #include "numeric.h" #include "timer.h" #include "thread/thread.h" diff --git a/src/debug/quad.cpp b/src/debug/quad.cpp index f334fa2d..226dc5ba 100644 --- a/src/debug/quad.cpp +++ b/src/debug/quad.cpp @@ -20,7 +20,6 @@ # include #endif -#include #include #include diff --git a/src/debug/sphere.cpp b/src/debug/sphere.cpp index 90a8368e..48138579 100644 --- a/src/debug/sphere.cpp +++ b/src/debug/sphere.cpp @@ -20,8 +20,6 @@ # include #endif -#include - #include "core.h" #include "lolgl.h" #include "loldebug.h" diff --git a/src/emitter.cpp b/src/emitter.cpp index dc52d5ca..ad51b256 100644 --- a/src/emitter.cpp +++ b/src/emitter.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #include "core.h" namespace lol diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index 6974b60f..f813b2d3 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -12,7 +12,6 @@ # include "config.h" #endif -#include #include #include diff --git a/src/gradient.cpp b/src/gradient.cpp index f7ae69a3..3b1bc6df 100644 --- a/src/gradient.cpp +++ b/src/gradient.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #include "core.h" #include "lolgl.h" diff --git a/src/image/codec/android-image.cpp b/src/image/codec/android-image.cpp index b752ec45..e931e4e9 100644 --- a/src/image/codec/android-image.cpp +++ b/src/image/codec/android-image.cpp @@ -14,8 +14,6 @@ #if defined __ANDROID__ -#include - #include #include diff --git a/src/image/codec/dummy-image.cpp b/src/image/codec/dummy-image.cpp index 406b4e6f..8190426a 100644 --- a/src/image/codec/dummy-image.cpp +++ b/src/image/codec/dummy-image.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #include "core.h" #include "../../image/image-private.h" diff --git a/src/image/codec/gdiplus-image.cpp b/src/image/codec/gdiplus-image.cpp index 6ccad07e..7ee4042f 100644 --- a/src/image/codec/gdiplus-image.cpp +++ b/src/image/codec/gdiplus-image.cpp @@ -14,8 +14,6 @@ #if defined USE_GDIPLUS -#include - #include using namespace std; diff --git a/src/image/codec/ios-image.cpp b/src/image/codec/ios-image.cpp index baa00396..502329fe 100644 --- a/src/image/codec/ios-image.cpp +++ b/src/image/codec/ios-image.cpp @@ -14,7 +14,6 @@ #if defined __APPLE__ && defined __MACH__ && defined __arm__ -#include #import #include "core.h" diff --git a/src/image/codec/ps3-image.cpp b/src/image/codec/ps3-image.cpp index d4c84894..a5859ceb 100644 --- a/src/image/codec/ps3-image.cpp +++ b/src/image/codec/ps3-image.cpp @@ -14,8 +14,6 @@ #if defined __CELLOS_LV2__ -#include - #include #include diff --git a/src/image/codec/sdl-image.cpp b/src/image/codec/sdl-image.cpp index 996efd25..b279e37e 100644 --- a/src/image/codec/sdl-image.cpp +++ b/src/image/codec/sdl-image.cpp @@ -14,8 +14,6 @@ #if defined USE_SDL_IMAGE -#include - #include #include diff --git a/src/image/image.cpp b/src/image/image.cpp index 9f12d213..46b40027 100644 --- a/src/image/image.cpp +++ b/src/image/image.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #include "core.h" #include "image-private.h" diff --git a/src/input/input.cpp b/src/input/input.cpp index 2f6a51bc..797b3f25 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -13,7 +13,6 @@ #endif #include -#include #if defined USE_SDL # include diff --git a/src/input/stick.cpp b/src/input/stick.cpp index 97aefcde..44db844f 100644 --- a/src/input/stick.cpp +++ b/src/input/stick.cpp @@ -13,7 +13,6 @@ #endif #include -#include #include "core.h" diff --git a/src/log.cpp b/src/log.cpp index bfe98b9f..9cf0cb76 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -12,7 +12,6 @@ # include "config.h" #endif -#include #include #if defined __ANDROID__ diff --git a/src/lol/math/trig.h b/src/lol/math/math.h similarity index 87% rename from src/lol/math/trig.h rename to src/lol/math/math.h index 1d7b00a0..793cd2e5 100644 --- a/src/lol/math/trig.h +++ b/src/lol/math/math.h @@ -9,13 +9,14 @@ // // -// Trigonometry functions -// ---------------------- +// Various maths functions +// ----------------------- // -#if !defined __LOL_MATH_TRIG_H__ -#define __LOL_MATH_TRIG_H__ +#if !defined __LOL_MATH_MATH_H__ +#define __LOL_MATH_MATH_H__ +#include #include #include @@ -23,16 +24,19 @@ namespace lol { /* Standard cmath functions */ +static inline double sqrt(double const &x) { return std::sqrt(x); } +static inline float sqrt(float const &x) { return std::sqrt(x); } + static inline double sin(double const &x) { return std::sin(x); } static inline double cos(double const &x) { return std::cos(x); } static inline double tan(double const &x) { return std::tan(x); } -static inline double asin(double const &x) { return std::asin(x); } -static inline double acos(double const &x) { return std::acos(x); } -static inline double atan(double const &x) { return std::atan(x); } - static inline float sin(float const &x) { return std::sin(x); } static inline float cos(float const &x) { return std::cos(x); } static inline float tan(float const &x) { return std::tan(x); } + +static inline double asin(double const &x) { return std::asin(x); } +static inline double acos(double const &x) { return std::acos(x); } +static inline double atan(double const &x) { return std::atan(x); } static inline float asin(float const &x) { return std::asin(x); } static inline float acos(float const &x) { return std::acos(x); } static inline float atan(float const &x) { return std::atan(x); } @@ -73,5 +77,5 @@ double lol_atan2(double, double); } /* namespace lol */ -#endif // __LOL_MATH_TRIG_H__ +#endif // __LOL_MATH_MATH_H__ diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 51a74f5f..fbd31277 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -17,10 +17,10 @@ #define __LOL_MATH_VECTOR_H__ #include -#include #include #include +#include "lol/math/math.h" #include "lol/math/half.h" #include "lol/math/real.h" @@ -1198,7 +1198,6 @@ static inline Quat operator /(Quat x, Quat const &y) tprefix \ inline double length(tname const &a) \ { \ - using std::sqrt; \ return sqrt((double)sqlength(a)); \ } \ \ diff --git a/src/lol/unit.h b/src/lol/unit.h index 081adb67..5bea0ef5 100644 --- a/src/lol/unit.h +++ b/src/lol/unit.h @@ -20,7 +20,6 @@ #include #include #include -#include namespace lol { diff --git a/src/map.cpp b/src/map.cpp index 1cca34fc..e6e86395 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include "core.h" diff --git a/src/math/real.cpp b/src/math/real.cpp index a66b167c..48064e50 100644 --- a/src/math/real.cpp +++ b/src/math/real.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include "core.h" diff --git a/src/math/trig.cpp b/src/math/trig.cpp index fc27a2d1..304b479a 100644 --- a/src/math/trig.cpp +++ b/src/math/trig.cpp @@ -16,8 +16,6 @@ # include #endif -#include - #include "core.h" using namespace std; diff --git a/src/math/vector.cpp b/src/math/vector.cpp index a906a826..d3d96ac7 100644 --- a/src/math/vector.cpp +++ b/src/math/vector.cpp @@ -25,7 +25,6 @@ # undef far /* Fuck Microsoft again */ #endif -#include /* for M_PI */ #include /* free() */ #include /* strdup() */ diff --git a/src/numeric.h b/src/numeric.h index 7fd0ed31..9c2211aa 100644 --- a/src/numeric.h +++ b/src/numeric.h @@ -16,7 +16,6 @@ #if !defined __LOL_NUMERIC_H__ #define __LOL_NUMERIC_H__ -#include #include #include diff --git a/src/platform.cpp b/src/platform.cpp index a8c1279e..50e2e5a3 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #include "core.h" namespace lol diff --git a/src/sample.cpp b/src/sample.cpp index 1877fc5c..88d9ac99 100644 --- a/src/sample.cpp +++ b/src/sample.cpp @@ -14,7 +14,6 @@ #include #include -#include #include #if defined USE_SDL_MIXER diff --git a/src/scene.cpp b/src/scene.cpp index 337aa44e..3f8516cb 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -13,7 +13,6 @@ #endif #include -#include #ifdef WIN32 # define WIN32_LEAN_AND_MEAN diff --git a/src/tileset.cpp b/src/tileset.cpp index 7ef04bd5..df94b914 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -14,7 +14,6 @@ #include #include -#include #include #if defined WIN32 && !defined _XBOX diff --git a/src/video.cpp b/src/video.cpp index a20440b3..497e2bf3 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -12,8 +12,6 @@ # include "config.h" #endif -#include - #if defined _XBOX # include # undef near /* Fuck Microsoft */ diff --git a/test/tutorial/03_fractal.cpp b/test/tutorial/03_fractal.cpp index b41c76cc..1b90fb71 100644 --- a/test/tutorial/03_fractal.cpp +++ b/test/tutorial/03_fractal.cpp @@ -13,7 +13,6 @@ #endif #include -#include #include "core.h" #include "lolgl.h" @@ -116,9 +115,9 @@ public: { double f = (double)i / PALETTE_STEP; - double r = 0.5 * sin(f * 0.27 + 2.0) + 0.5; - double g = 0.5 * sin(f * 0.17 - 1.8) + 0.5; - double b = 0.5 * sin(f * 0.21 - 2.6) + 0.5; + double r = 0.5 * lol::sin(f * 0.27 + 2.0) + 0.5; + double g = 0.5 * lol::sin(f * 0.17 - 1.8) + 0.5; + double b = 0.5 * lol::sin(f * 0.21 - 2.6) + 0.5; if (f < 7.0) { diff --git a/test/xolotl/xolotl.cpp b/test/xolotl/xolotl.cpp index 2c6b6873..d2b19b68 100644 --- a/test/xolotl/xolotl.cpp +++ b/test/xolotl/xolotl.cpp @@ -37,7 +37,7 @@ public: for(int i = 0; i < 2000; i++) { float x = (i - 1000.0) / 100.0; graph[i].x = x; - graph[i].y = sin(x * 10.0) / (1.0 + x * x); + graph[i].y = lol::sin(x * 10.0) / (1.0 + x * x); } } diff --git a/win32/lolcore.vcxproj b/win32/lolcore.vcxproj index e2a0a2cc..a2f37400 100644 --- a/win32/lolcore.vcxproj +++ b/win32/lolcore.vcxproj @@ -172,9 +172,9 @@ + - diff --git a/win32/lolcore.vcxproj.filters b/win32/lolcore.vcxproj.filters index 7d73de9c..64fe3829 100644 --- a/win32/lolcore.vcxproj.filters +++ b/win32/lolcore.vcxproj.filters @@ -264,13 +264,13 @@ src\lol\math - + src\lol\math - + src\lol\math - + src\lol\math