Changeset 1513


Ignore:
Timestamp:
Jun 23, 2012, 12:46:39 PM (8 years ago)
Author:
sam
Message:

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

Location:
trunk
Files:
35 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/neercs/neercs.cpp

    r1490 r1513  
    6363    caca_clear_canvas(m_caca);
    6464
    65     caca_fill_ellipse(m_caca, 20+10 * cos(m_time * 1.f), 10+10 * sin(m_time * 1.f), 16+8 * sin(m_time * 6.f), 12+6 * cos(m_time * 5.f), '|');
    66     caca_fill_ellipse(m_caca, 20+10 * cos(m_time * 1.f), 10+10 * sin(m_time * 1.f), 12+8 * sin(m_time * 6.f), 8+6 * cos(m_time * 5.f), ' ');
     65    caca_fill_ellipse(m_caca, 20+10 * lol::cos(m_time * 1.f), 10+10 * lol::sin(m_time * 1.f), 16+8 * lol::sin(m_time * 6.f), 12+6 * lol::cos(m_time * 5.f), '|');
     66    caca_fill_ellipse(m_caca, 20+10 * lol::cos(m_time * 1.f), 10+10 * lol::sin(m_time * 1.f), 12+8 * lol::sin(m_time * 6.f), 8+6 * lol::cos(m_time * 5.f), ' ');
    6767
    6868    caca_set_color_ansi(m_caca, 2, CACA_DEFAULT);
    69     int x1 = 12 + 10 * cos(m_time * 5.f);
    70     int y1 = 6 + 5 * sin(m_time * 5.f);
    71     int x2 = 30 + 5 * cos(m_time * 8.f);
    72     int y2 = 8 + 5 * sin(m_time * 8.f);
    73     int y3 = 8 + 5 * cos(m_time * 5.f);
     69    int x1 = 12 + 10 * lol::cos(m_time * 5.f);
     70    int y1 = 6 + 5 * lol::sin(m_time * 5.f);
     71    int x2 = 30 + 5 * lol::cos(m_time * 8.f);
     72    int y2 = 8 + 5 * lol::sin(m_time * 8.f);
     73    int y3 = 8 + 5 * lol::cos(m_time * 5.f);
    7474    caca_draw_thin_line(m_caca, x1, y1, x2, y2);
    7575    caca_draw_thin_line(m_caca, 40, y3, x2, y2);
    7676    caca_draw_thin_line(m_caca, x1, y1, 40, y3);
    7777
    78     int x3 = 13 + 7 * cos(m_time * 3.f);
     78    int x3 = 13 + 7 * lol::cos(m_time * 3.f);
    7979    caca_set_color_ansi(m_caca, CACA_CYAN, CACA_BLUE);
    8080    caca_put_str(m_caca, x3, 3, " LOL WUT ");
    8181
    82     int x4 = 6 + 5 * cos(m_time * 2.f);
     82    int x4 = 6 + 5 * lol::cos(m_time * 2.f);
    8383    caca_set_color_ansi(m_caca, CACA_YELLOW, CACA_RED);
    8484    caca_put_str(m_caca, x4, 25, "Le Caca C'Est Surpuissant \\:D/");
  • trunk/src/Makefile.am

    r1512 r1513  
    1515    lol/unit.h lol/debug.h \
    1616    lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \
    17     lol/math/trig.h \
     17    lol/math/math.h \
    1818    \
    1919    generated/location.hh generated/position.hh generated/stack.hh \
  • trunk/src/audio.cpp

    r950 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#if defined USE_SDL_MIXER
  • trunk/src/core.h

    r1512 r1513  
    6969// Base types
    7070#include "lol/debug.h"
     71#include "lol/math/math.h"
    7172#include "lol/math/half.h"
    7273#include "lol/math/real.h"
    7374#include "lol/math/vector.h"
    74 #include "lol/math/trig.h"
    7575#include "numeric.h"
    7676#include "timer.h"
  • trunk/src/debug/quad.cpp

    r1310 r1513  
    2121#endif
    2222
    23 #include <cmath>
    2423#include <cstdio>
    2524#include <cstring>
  • trunk/src/debug/sphere.cpp

    r1310 r1513  
    2020#   include <windows.h>
    2121#endif
    22 
    23 #include <cmath>
    2422
    2523#include "core.h"
  • trunk/src/emitter.cpp

    r1310 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#include "core.h"
  • trunk/src/gpu/shader.cpp

    r1470 r1513  
    1313#endif
    1414
    15 #include <cmath>
    1615#include <cstring>
    1716#include <cstdio>
  • trunk/src/gradient.cpp

    r1337 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#include "core.h"
  • trunk/src/image/codec/android-image.cpp

    r963 r1513  
    1414
    1515#if defined __ANDROID__
    16 
    17 #include <cmath>
    1816
    1917#include <jni.h>
  • trunk/src/image/codec/dummy-image.cpp

    r1046 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#include "core.h"
  • trunk/src/image/codec/gdiplus-image.cpp

    r1408 r1513  
    1414
    1515#if defined USE_GDIPLUS
    16 
    17 #include <cmath>
    1816
    1917#include <algorithm>
  • trunk/src/image/codec/ios-image.cpp

    r962 r1513  
    1515#if defined __APPLE__ && defined __MACH__ && defined __arm__
    1616
    17 #include <cmath>
    1817#import <UIKit/UIKit.h>
    1918
  • trunk/src/image/codec/ps3-image.cpp

    r1057 r1513  
    1414
    1515#if defined __CELLOS_LV2__
    16 
    17 #include <cmath>
    1816
    1917#include <cell/sysmodule.h>
  • trunk/src/image/codec/sdl-image.cpp

    r1183 r1513  
    1414
    1515#if defined USE_SDL_IMAGE
    16 
    17 #include <cmath>
    1816
    1917#include <SDL.h>
  • trunk/src/image/image.cpp

    r1162 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#include "core.h"
  • trunk/src/input/input.cpp

    r1342 r1513  
    1414
    1515#include <cstdlib>
    16 #include <cmath>
    1716
    1817#if defined USE_SDL
  • trunk/src/input/stick.cpp

    r1355 r1513  
    1414
    1515#include <cstdlib>
    16 #include <cmath>
    1716
    1817#include "core.h"
  • trunk/src/log.cpp

    r939 r1513  
    1313#endif
    1414
    15 #include <cmath>
    1615#include <cstdio>
    1716
  • trunk/src/lol/math/math.h

    r1512 r1513  
    1010
    1111//
    12 // Trigonometry functions
    13 // ----------------------
     12// Various maths functions
     13// -----------------------
    1414//
    1515
    16 #if !defined __LOL_MATH_TRIG_H__
    17 #define __LOL_MATH_TRIG_H__
     16#if !defined __LOL_MATH_MATH_H__
     17#define __LOL_MATH_MATH_H__
    1818
     19#include <cmath>
    1920#include <cstdio>
    2021#include <stdint.h>
     
    2425
    2526/* Standard cmath functions */
     27static inline double sqrt(double const &x) { return std::sqrt(x); }
     28static inline float sqrt(float const &x) { return std::sqrt(x); }
     29
    2630static inline double sin(double const &x) { return std::sin(x); }
    2731static inline double cos(double const &x) { return std::cos(x); }
    2832static inline double tan(double const &x) { return std::tan(x); }
     33static inline float sin(float const &x) { return std::sin(x); }
     34static inline float cos(float const &x) { return std::cos(x); }
     35static inline float tan(float const &x) { return std::tan(x); }
     36
    2937static inline double asin(double const &x) { return std::asin(x); }
    3038static inline double acos(double const &x) { return std::acos(x); }
    3139static inline double atan(double const &x) { return std::atan(x); }
    32 
    33 static inline float sin(float const &x) { return std::sin(x); }
    34 static inline float cos(float const &x) { return std::cos(x); }
    35 static inline float tan(float const &x) { return std::tan(x); }
    3640static inline float asin(float const &x) { return std::asin(x); }
    3741static inline float acos(float const &x) { return std::acos(x); }
     
    7478} /* namespace lol */
    7579
    76 #endif // __LOL_MATH_TRIG_H__
     80#endif // __LOL_MATH_MATH_H__
    7781
  • trunk/src/lol/math/vector.h

    r1426 r1513  
    1818
    1919#include <stdint.h>
    20 #include <cmath>
    2120#include <ostream>
    2221#include <algorithm>
    2322
     23#include "lol/math/math.h"
    2424#include "lol/math/half.h"
    2525#include "lol/math/real.h"
     
    11991199    inline double length(tname<type> const &a) \
    12001200    { \
    1201         using std::sqrt; \
    12021201        return sqrt((double)sqlength(a)); \
    12031202    } \
  • trunk/src/lol/unit.h

    r1163 r1513  
    2121#include <sstream>
    2222#include <cstdio>
    23 #include <cmath>
    2423
    2524namespace lol
  • trunk/src/map.cpp

    r1198 r1513  
    1616#include <cstring>
    1717#include <cstdlib>
    18 #include <cmath>
    1918#include <ctype.h>
    2019
  • trunk/src/math/real.cpp

    r1311 r1513  
    3030#include <cstdio>
    3131#include <cstdlib>
    32 #include <cmath>
    3332
    3433#include "core.h"
  • trunk/src/math/trig.cpp

    r1180 r1513  
    1616#   include <fastmath.h>
    1717#endif
    18 
    19 #include <cmath>
    2018
    2119#include "core.h"
  • trunk/src/math/vector.cpp

    r1512 r1513  
    2626#endif
    2727
    28 #include <cmath> /* for M_PI */
    2928#include <cstdlib> /* free() */
    3029#include <cstring> /* strdup() */
  • trunk/src/numeric.h

    r761 r1513  
    1717#define __LOL_NUMERIC_H__
    1818
    19 #include <cmath>
    2019#include <cstdlib>
    2120#include <stdint.h>
  • trunk/src/platform.cpp

    r939 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#include "core.h"
  • trunk/src/sample.cpp

    r1310 r1513  
    1515#include <cstdlib>
    1616#include <cstdio>
    17 #include <cmath>
    1817#include <cstring>
    1918
  • trunk/src/scene.cpp

    r1329 r1513  
    1414
    1515#include <cstdlib>
    16 #include <cmath>
    1716
    1817#ifdef WIN32
  • trunk/src/tileset.cpp

    r1337 r1513  
    1515#include <cstdlib>
    1616#include <cstdio>
    17 #include <cmath>
    1817#include <cstring>
    1918
  • trunk/src/video.cpp

    r1325 r1513  
    1212#   include "config.h"
    1313#endif
    14 
    15 #include <cmath>
    1614
    1715#if defined _XBOX
  • trunk/test/tutorial/03_fractal.cpp

    r1512 r1513  
    1414
    1515#include <cstring>
    16 #include <cmath>
    1716
    1817#include "core.h"
     
    117116            double f = (double)i / PALETTE_STEP;
    118117
    119             double r = 0.5 * sin(f * 0.27 + 2.0) + 0.5;
    120             double g = 0.5 * sin(f * 0.17 - 1.8) + 0.5;
    121             double b = 0.5 * sin(f * 0.21 - 2.6) + 0.5;
     118            double r = 0.5 * lol::sin(f * 0.27 + 2.0) + 0.5;
     119            double g = 0.5 * lol::sin(f * 0.17 - 1.8) + 0.5;
     120            double b = 0.5 * lol::sin(f * 0.21 - 2.6) + 0.5;
    122121
    123122            if (f < 7.0)
  • trunk/test/xolotl/xolotl.cpp

    r1512 r1513  
    3838          float x = (i - 1000.0) / 100.0;
    3939          graph[i].x = x;
    40           graph[i].y = sin(x * 10.0) / (1.0 + x * x);
     40          graph[i].y = lol::sin(x * 10.0) / (1.0 + x * x);
    4141        }
    4242    }
  • trunk/win32/lolcore.vcxproj

    r1512 r1513  
    173173    <ClInclude Include="..\src\lol\debug.h" />
    174174    <ClInclude Include="..\src\lol\math\half.h" />
     175    <ClInclude Include="..\src\lol\math\math.h" />
    175176    <ClInclude Include="..\src\lol\math\real.h" />
    176177    <ClInclude Include="..\src\lol\math\remez.h" />
    177     <ClInclude Include="..\src\lol\math\trig.h" />
    178178    <ClInclude Include="..\src\lol\math\vector.h" />
    179179    <ClInclude Include="..\src\lol\unit.h" />
  • trunk/win32/lolcore.vcxproj.filters

    r1512 r1513  
    265265      <Filter>src\lol\math</Filter>
    266266    </ClInclude>
     267    <ClInclude Include="..\src\lol\math\math.h">
     268      <Filter>src\lol\math</Filter>
     269    </ClInclude>
    267270    <ClInclude Include="..\src\lol\math\real.h">
    268271      <Filter>src\lol\math</Filter>
    269272    </ClInclude>
    270273    <ClInclude Include="..\src\lol\math\remez.h">
    271       <Filter>src\lol\math</Filter>
    272     </ClInclude>
    273     <ClInclude Include="..\src\lol\math\trig.h">
    274274      <Filter>src\lol\math</Filter>
    275275    </ClInclude>
Note: See TracChangeset for help on using the changeset viewer.