Ver código fonte

core: replace usage of sin() or std::sin() with lol::sin() where appropriate.

legacy
Sam Hocevar sam 12 anos atrás
pai
commit
28728814cc
35 arquivos alterados com 24 adições e 62 exclusões
  1. +1
    -1
      src/Makefile.am
  2. +0
    -2
      src/audio.cpp
  3. +1
    -1
      src/core.h
  4. +0
    -1
      src/debug/quad.cpp
  5. +0
    -2
      src/debug/sphere.cpp
  6. +0
    -2
      src/emitter.cpp
  7. +0
    -1
      src/gpu/shader.cpp
  8. +0
    -2
      src/gradient.cpp
  9. +0
    -2
      src/image/codec/android-image.cpp
  10. +0
    -2
      src/image/codec/dummy-image.cpp
  11. +0
    -2
      src/image/codec/gdiplus-image.cpp
  12. +0
    -1
      src/image/codec/ios-image.cpp
  13. +0
    -2
      src/image/codec/ps3-image.cpp
  14. +0
    -2
      src/image/codec/sdl-image.cpp
  15. +0
    -2
      src/image/image.cpp
  16. +0
    -1
      src/input/input.cpp
  17. +0
    -1
      src/input/stick.cpp
  18. +0
    -1
      src/log.cpp
  19. +13
    -9
      src/lol/math/math.h
  20. +1
    -2
      src/lol/math/vector.h
  21. +0
    -1
      src/lol/unit.h
  22. +0
    -1
      src/map.cpp
  23. +0
    -1
      src/math/real.cpp
  24. +0
    -2
      src/math/trig.cpp
  25. +0
    -1
      src/math/vector.cpp
  26. +0
    -1
      src/numeric.h
  27. +0
    -2
      src/platform.cpp
  28. +0
    -1
      src/sample.cpp
  29. +0
    -1
      src/scene.cpp
  30. +0
    -1
      src/tileset.cpp
  31. +0
    -2
      src/video.cpp
  32. +3
    -4
      test/tutorial/03_fractal.cpp
  33. +1
    -1
      test/xolotl/xolotl.cpp
  34. +1
    -1
      win32/lolcore.vcxproj
  35. +3
    -3
      win32/lolcore.vcxproj.filters

+ 1
- 1
src/Makefile.am Ver arquivo

@@ -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 \
\


+ 0
- 2
src/audio.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#if defined USE_SDL_MIXER
# include <SDL.h>
# include <SDL_mixer.h>


+ 1
- 1
src/core.h Ver arquivo

@@ -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"


+ 0
- 1
src/debug/quad.cpp Ver arquivo

@@ -20,7 +20,6 @@
# include <windows.h>
#endif

#include <cmath>
#include <cstdio>
#include <cstring>



+ 0
- 2
src/debug/sphere.cpp Ver arquivo

@@ -20,8 +20,6 @@
# include <windows.h>
#endif

#include <cmath>

#include "core.h"
#include "lolgl.h"
#include "loldebug.h"


+ 0
- 2
src/emitter.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#include "core.h"

namespace lol


+ 0
- 1
src/gpu/shader.cpp Ver arquivo

@@ -12,7 +12,6 @@
# include "config.h"
#endif

#include <cmath>
#include <cstring>
#include <cstdio>



+ 0
- 2
src/gradient.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#include "core.h"
#include "lolgl.h"



+ 0
- 2
src/image/codec/android-image.cpp Ver arquivo

@@ -14,8 +14,6 @@

#if defined __ANDROID__

#include <cmath>

#include <jni.h>
#include <android/log.h>



+ 0
- 2
src/image/codec/dummy-image.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#include "core.h"
#include "../../image/image-private.h"



+ 0
- 2
src/image/codec/gdiplus-image.cpp Ver arquivo

@@ -14,8 +14,6 @@

#if defined USE_GDIPLUS

#include <cmath>

#include <algorithm>

using namespace std;


+ 0
- 1
src/image/codec/ios-image.cpp Ver arquivo

@@ -14,7 +14,6 @@

#if defined __APPLE__ && defined __MACH__ && defined __arm__

#include <cmath>
#import <UIKit/UIKit.h>

#include "core.h"


+ 0
- 2
src/image/codec/ps3-image.cpp Ver arquivo

@@ -14,8 +14,6 @@

#if defined __CELLOS_LV2__

#include <cmath>

#include <cell/sysmodule.h>
#include <cell/codec/pngdec.h>



+ 0
- 2
src/image/codec/sdl-image.cpp Ver arquivo

@@ -14,8 +14,6 @@

#if defined USE_SDL_IMAGE

#include <cmath>

#include <SDL.h>
#include <SDL_image.h>



+ 0
- 2
src/image/image.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#include "core.h"
#include "image-private.h"



+ 0
- 1
src/input/input.cpp Ver arquivo

@@ -13,7 +13,6 @@
#endif

#include <cstdlib>
#include <cmath>

#if defined USE_SDL
# include <SDL.h>


+ 0
- 1
src/input/stick.cpp Ver arquivo

@@ -13,7 +13,6 @@
#endif

#include <cstdlib>
#include <cmath>

#include "core.h"



+ 0
- 1
src/log.cpp Ver arquivo

@@ -12,7 +12,6 @@
# include "config.h"
#endif

#include <cmath>
#include <cstdio>

#if defined __ANDROID__


src/lol/math/trig.h → src/lol/math/math.h Ver arquivo

@@ -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 <cmath>
#include <cstdio>
#include <stdint.h>

@@ -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__


+ 1
- 2
src/lol/math/vector.h Ver arquivo

@@ -17,10 +17,10 @@
#define __LOL_MATH_VECTOR_H__

#include <stdint.h>
#include <cmath>
#include <ostream>
#include <algorithm>

#include "lol/math/math.h"
#include "lol/math/half.h"
#include "lol/math/real.h"

@@ -1198,7 +1198,6 @@ static inline Quat<T> operator /(Quat<T> x, Quat<T> const &y)
tprefix \
inline double length(tname<type> const &a) \
{ \
using std::sqrt; \
return sqrt((double)sqlength(a)); \
} \
\


+ 0
- 1
src/lol/unit.h Ver arquivo

@@ -20,7 +20,6 @@
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>

namespace lol
{


+ 0
- 1
src/map.cpp Ver arquivo

@@ -15,7 +15,6 @@
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctype.h>

#include "core.h"


+ 0
- 1
src/math/real.cpp Ver arquivo

@@ -29,7 +29,6 @@
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#include "core.h"



+ 0
- 2
src/math/trig.cpp Ver arquivo

@@ -16,8 +16,6 @@
# include <fastmath.h>
#endif

#include <cmath>

#include "core.h"

using namespace std;


+ 0
- 1
src/math/vector.cpp Ver arquivo

@@ -25,7 +25,6 @@
# undef far /* Fuck Microsoft again */
#endif

#include <cmath> /* for M_PI */
#include <cstdlib> /* free() */
#include <cstring> /* strdup() */



+ 0
- 1
src/numeric.h Ver arquivo

@@ -16,7 +16,6 @@
#if !defined __LOL_NUMERIC_H__
#define __LOL_NUMERIC_H__

#include <cmath>
#include <cstdlib>
#include <stdint.h>



+ 0
- 2
src/platform.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#include "core.h"

namespace lol


+ 0
- 1
src/sample.cpp Ver arquivo

@@ -14,7 +14,6 @@

#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>

#if defined USE_SDL_MIXER


+ 0
- 1
src/scene.cpp Ver arquivo

@@ -13,7 +13,6 @@
#endif

#include <cstdlib>
#include <cmath>

#ifdef WIN32
# define WIN32_LEAN_AND_MEAN


+ 0
- 1
src/tileset.cpp Ver arquivo

@@ -14,7 +14,6 @@

#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>

#if defined WIN32 && !defined _XBOX


+ 0
- 2
src/video.cpp Ver arquivo

@@ -12,8 +12,6 @@
# include "config.h"
#endif

#include <cmath>

#if defined _XBOX
# include <xtl.h>
# undef near /* Fuck Microsoft */


+ 3
- 4
test/tutorial/03_fractal.cpp Ver arquivo

@@ -13,7 +13,6 @@
#endif

#include <cstring>
#include <cmath>

#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)
{


+ 1
- 1
test/xolotl/xolotl.cpp Ver arquivo

@@ -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);
}
}



+ 1
- 1
win32/lolcore.vcxproj Ver arquivo

@@ -172,9 +172,9 @@
<ClInclude Include="..\src\lolgl.h" />
<ClInclude Include="..\src\lol\debug.h" />
<ClInclude Include="..\src\lol\math\half.h" />
<ClInclude Include="..\src\lol\math\math.h" />
<ClInclude Include="..\src\lol\math\real.h" />
<ClInclude Include="..\src\lol\math\remez.h" />
<ClInclude Include="..\src\lol\math\trig.h" />
<ClInclude Include="..\src\lol\math\vector.h" />
<ClInclude Include="..\src\lol\unit.h" />
<ClInclude Include="..\src\map.h" />


+ 3
- 3
win32/lolcore.vcxproj.filters Ver arquivo

@@ -264,13 +264,13 @@
<ClInclude Include="..\src\lol\math\half.h">
<Filter>src\lol\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\real.h">
<ClInclude Include="..\src\lol\math\math.h">
<Filter>src\lol\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\remez.h">
<ClInclude Include="..\src\lol\math\real.h">
<Filter>src\lol\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\trig.h">
<ClInclude Include="..\src\lol\math\remez.h">
<Filter>src\lol\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\vector.h">


Carregando…
Cancelar
Salvar