Browse Source

build: fix the PS3 port by using our trig.h everywhere instead of stdlib

functions; also remove a lot of idiotic "using namespace std" from the
codebase.
legacy
Sam Hocevar sam 12 years ago
parent
commit
8375f3443d
14 changed files with 183 additions and 145 deletions
  1. +2
    -1
      src/Makefile.am
  2. +2
    -2
      src/core.h
  3. +11
    -5
      src/easymesh/easymesh-scanner.l
  4. +3
    -3
      src/easymesh/easymesh.cpp
  5. +59
    -53
      src/generated/easymesh-scanner.cpp
  6. +2
    -1
      src/gpu/vertexbuffer.cpp
  7. +77
    -0
      src/lol/math/trig.h
  8. +0
    -38
      src/math/trig.h
  9. +6
    -14
      src/math/vector.cpp
  10. +3
    -4
      test/tutorial/03_fractal.cpp
  11. +11
    -16
      test/unit/trig.cpp
  12. +1
    -2
      test/xolotl/xolotl.cpp
  13. +2
    -2
      win32/lolcore.vcxproj
  14. +4
    -4
      win32/lolcore.vcxproj.filters

+ 2
- 1
src/Makefile.am View File

@@ -14,6 +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 \
\
generated/location.hh generated/position.hh generated/stack.hh \
\
@@ -35,7 +36,7 @@ liblol_a_SOURCES = \
\
thread/threadbase.h thread/thread.h \
\
math/vector.cpp math/real.cpp math/half.cpp math/trig.cpp math/trig.h \
math/vector.cpp math/real.cpp math/half.cpp math/trig.cpp \
\
input/input.cpp input/input.h \
input/stick.cpp input/stick.h \


+ 2
- 2
src/core.h View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
@@ -68,10 +68,10 @@ static inline int isnan(float f)

// Base types
#include "lol/debug.h"
#include "math/trig.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"


+ 11
- 5
src/easymesh/easymesh-scanner.l View File

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

#include <cstdlib>
using std::exit;
using std::malloc;
using std::realloc;
using std::free;

#include "core.h"
#include "easymesh/easymesh-compiler.h"

@@ -77,14 +83,14 @@ aq { return token::T_QUAD; }
acg { return token::T_COG; }

#[0-9a-f]{3} {
uint32_t tmp = strtol(yytext + 1, NULL, 16);
uint32_t tmp = std::strtol(yytext + 1, NULL, 16);
yylval->u32val = 0x11000000u * (tmp >> 8)
| 0x00110000u * ((tmp >> 4) & 0xf)
| 0x00001100u * (tmp & 0xf)
| 0x000000ffu;
return token::COLOR; }
#[0-9a-f]{4} {
uint32_t tmp = strtol(yytext + 1, NULL, 16);
uint32_t tmp = std::strtol(yytext + 1, NULL, 16);
yylval->u32val = 0x11000000u * (tmp >> 12)
| 0x00110000u * ((tmp >> 8) & 0xf)
| 0x00001100u * ((tmp >> 4) & 0xf)
@@ -92,13 +98,13 @@ acg { return token::T_COG; }
return token::COLOR; }
#[0-9a-f]{6} {
yylval->u32val = 0xffu
| 0x100u * (uint32_t)strtol(yytext + 1, NULL, 16);
| 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16);
return token::COLOR; }
#[0-9a-f]{8} {
yylval->u32val = (uint32_t)strtol(yytext + 1, NULL, 16);
yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16);
return token::COLOR; }
[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? {
yylval->fval = atof(yytext); return token::NUMBER; }
yylval->fval = std::atof(yytext); return token::NUMBER; }
- { return token_type('-'); }
"[" { return token_type('['); }
"]" { return token_type(']'); }


+ 3
- 3
src/easymesh/easymesh.cpp View File

@@ -352,12 +352,12 @@ void EasyMesh::AppendSphere(int ndivisions, vec3 const &size)
int vbase = m_vert.Count();

vec3 d = size * 0.5f;
float const pi = std::acos(-1.0f);
float const pi = acos(-1.0f);

Array<vec2> table;
for (int i = 0; i <= ndivisions; i++)
table.Push(vec2(std::sin(pi * 2 / ndivisions * i) + 1e-5f,
std::cos(pi * 2 / ndivisions * i) + 1e-5f));
table.Push(vec2(sin(pi * 2 / ndivisions * i) + 1e-5f,
cos(pi * 2 / ndivisions * i) + 1e-5f));

for (int j = 0; j <= ndivisions / 2; j++)
for (int i = 0; i < ndivisions; i++)


+ 59
- 53
src/generated/easymesh-scanner.cpp View File

@@ -474,6 +474,12 @@ static yyconst flex_int16_t yy_chk[124] =
# include "config.h"
#endif

#include <cstdlib>
using std::exit;
using std::malloc;
using std::realloc;
using std::free;

#include "core.h"
#include "easymesh/easymesh-compiler.h"

@@ -489,7 +495,7 @@ typedef lol::EasyMeshParser::token_type token_type;
#define yyterminate() return token::T_END
#define YY_NO_UNISTD_H
#define YY_USER_ACTION yylloc->columns(yyleng);
#line 493 "generated/easymesh-scanner.cpp"
#line 499 "generated/easymesh-scanner.cpp"

#define INITIAL 0

@@ -594,7 +600,7 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 38 "easymesh/easymesh-scanner.l"
#line 44 "easymesh/easymesh-scanner.l"



@@ -602,7 +608,7 @@ YY_DECL
yylloc->step();


#line 606 "generated/easymesh-scanner.cpp"
#line 612 "generated/easymesh-scanner.cpp"

if ( !(yy_init) )
{
@@ -683,164 +689,164 @@ do_action: /* This label is used only to access EOF actions. */

case 1:
YY_RULE_SETUP
#line 45 "easymesh/easymesh-scanner.l"
#line 51 "easymesh/easymesh-scanner.l"
{ return token::T_COLOR; }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 46 "easymesh/easymesh-scanner.l"
#line 52 "easymesh/easymesh-scanner.l"
{ return token::T_BGCOLOR; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 48 "easymesh/easymesh-scanner.l"
#line 54 "easymesh/easymesh-scanner.l"
{ return token::T_CHAMFER; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 49 "easymesh/easymesh-scanner.l"
#line 55 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATEX; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 50 "easymesh/easymesh-scanner.l"
#line 56 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATEY; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 51 "easymesh/easymesh-scanner.l"
#line 57 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATEZ; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 52 "easymesh/easymesh-scanner.l"
#line 58 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATE; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 53 "easymesh/easymesh-scanner.l"
#line 59 "easymesh/easymesh-scanner.l"
{ return token::T_ROTATEX; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 54 "easymesh/easymesh-scanner.l"
#line 60 "easymesh/easymesh-scanner.l"
{ return token::T_ROTATEY; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 55 "easymesh/easymesh-scanner.l"
#line 61 "easymesh/easymesh-scanner.l"
{ return token::T_ROTATEZ; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 56 "easymesh/easymesh-scanner.l"
#line 62 "easymesh/easymesh-scanner.l"
{ return token::T_TAPERX; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 57 "easymesh/easymesh-scanner.l"
#line 63 "easymesh/easymesh-scanner.l"
{ return token::T_TAPERY; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 58 "easymesh/easymesh-scanner.l"
#line 64 "easymesh/easymesh-scanner.l"
{ return token::T_TAPERZ; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 59 "easymesh/easymesh-scanner.l"
#line 65 "easymesh/easymesh-scanner.l"
{ return token::T_SCALEX; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 60 "easymesh/easymesh-scanner.l"
#line 66 "easymesh/easymesh-scanner.l"
{ return token::T_SCALEY; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 61 "easymesh/easymesh-scanner.l"
#line 67 "easymesh/easymesh-scanner.l"
{ return token::T_SCALEZ; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 62 "easymesh/easymesh-scanner.l"
#line 68 "easymesh/easymesh-scanner.l"
{ return token::T_SCALE; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 63 "easymesh/easymesh-scanner.l"
#line 69 "easymesh/easymesh-scanner.l"
{ return token::T_MIRRORX; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 64 "easymesh/easymesh-scanner.l"
#line 70 "easymesh/easymesh-scanner.l"
{ return token::T_MIRRORY; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 65 "easymesh/easymesh-scanner.l"
#line 71 "easymesh/easymesh-scanner.l"
{ return token::T_MIRRORZ; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 67 "easymesh/easymesh-scanner.l"
#line 73 "easymesh/easymesh-scanner.l"
{ return token::T_CYLINDER; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 68 "easymesh/easymesh-scanner.l"
#line 74 "easymesh/easymesh-scanner.l"
{ return token::T_BOX; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 69 "easymesh/easymesh-scanner.l"
#line 75 "easymesh/easymesh-scanner.l"
{ return token::T_SMOOTHCHAMFBOX; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 70 "easymesh/easymesh-scanner.l"
#line 76 "easymesh/easymesh-scanner.l"
{ return token::T_FLATCHAMFBOX; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 71 "easymesh/easymesh-scanner.l"
#line 77 "easymesh/easymesh-scanner.l"
{ return token::T_SPHERE; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 72 "easymesh/easymesh-scanner.l"
#line 78 "easymesh/easymesh-scanner.l"
{ return token::T_STAR; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 73 "easymesh/easymesh-scanner.l"
#line 79 "easymesh/easymesh-scanner.l"
{ return token::T_EXPANDEDSTAR; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 74 "easymesh/easymesh-scanner.l"
#line 80 "easymesh/easymesh-scanner.l"
{ return token::T_DISC; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 75 "easymesh/easymesh-scanner.l"
#line 81 "easymesh/easymesh-scanner.l"
{ return token::T_TRIANGLE; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 76 "easymesh/easymesh-scanner.l"
#line 82 "easymesh/easymesh-scanner.l"
{ return token::T_QUAD; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 77 "easymesh/easymesh-scanner.l"
#line 83 "easymesh/easymesh-scanner.l"
{ return token::T_COG; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 79 "easymesh/easymesh-scanner.l"
#line 85 "easymesh/easymesh-scanner.l"
{
uint32_t tmp = strtol(yytext + 1, NULL, 16);
uint32_t tmp = std::strtol(yytext + 1, NULL, 16);
yylval->u32val = 0x11000000u * (tmp >> 8)
| 0x00110000u * ((tmp >> 4) & 0xf)
| 0x00001100u * (tmp & 0xf)
@@ -849,9 +855,9 @@ YY_RULE_SETUP
YY_BREAK
case 33:
YY_RULE_SETUP
#line 86 "easymesh/easymesh-scanner.l"
#line 92 "easymesh/easymesh-scanner.l"
{
uint32_t tmp = strtol(yytext + 1, NULL, 16);
uint32_t tmp = std::strtol(yytext + 1, NULL, 16);
yylval->u32val = 0x11000000u * (tmp >> 12)
| 0x00110000u * ((tmp >> 8) & 0xf)
| 0x00001100u * ((tmp >> 4) & 0xf)
@@ -860,62 +866,62 @@ YY_RULE_SETUP
YY_BREAK
case 34:
YY_RULE_SETUP
#line 93 "easymesh/easymesh-scanner.l"
#line 99 "easymesh/easymesh-scanner.l"
{
yylval->u32val = 0xffu
| 0x100u * (uint32_t)strtol(yytext + 1, NULL, 16);
| 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16);
return token::COLOR; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 97 "easymesh/easymesh-scanner.l"
#line 103 "easymesh/easymesh-scanner.l"
{
yylval->u32val = (uint32_t)strtol(yytext + 1, NULL, 16);
yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16);
return token::COLOR; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 100 "easymesh/easymesh-scanner.l"
#line 106 "easymesh/easymesh-scanner.l"
{
yylval->fval = atof(yytext); return token::NUMBER; }
yylval->fval = std::atof(yytext); return token::NUMBER; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 102 "easymesh/easymesh-scanner.l"
#line 108 "easymesh/easymesh-scanner.l"
{ return token_type('-'); }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 103 "easymesh/easymesh-scanner.l"
#line 109 "easymesh/easymesh-scanner.l"
{ return token_type('['); }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 104 "easymesh/easymesh-scanner.l"
#line 110 "easymesh/easymesh-scanner.l"
{ return token_type(']'); }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 105 "easymesh/easymesh-scanner.l"
#line 111 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
YY_BREAK
case 41:
/* rule 41 can match eol */
YY_RULE_SETUP
#line 106 "easymesh/easymesh-scanner.l"
#line 112 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 107 "easymesh/easymesh-scanner.l"
#line 113 "easymesh/easymesh-scanner.l"
{ return token::T_ERROR; }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 109 "easymesh/easymesh-scanner.l"
#line 115 "easymesh/easymesh-scanner.l"
ECHO;
YY_BREAK
#line 919 "generated/easymesh-scanner.cpp"
#line 925 "generated/easymesh-scanner.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();

@@ -1816,7 +1822,7 @@ void EasyMeshfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 109 "easymesh/easymesh-scanner.l"
#line 115 "easymesh/easymesh-scanner.l"





+ 2
- 1
src/gpu/vertexbuffer.cpp View File

@@ -233,7 +233,7 @@ void VertexDeclaration::Unbind()
}
if (FAILED(g_d3ddevice->SetVertexDeclaration(NULL)))
Abort();
#else
#elif !defined __CELLOS_LV2__
/* FIXME: we need to unbind what we bound */
//glDisableVertexAttribArray(m_attrib);
/* FIXME: temporary kludge */
@@ -244,6 +244,7 @@ void VertexDeclaration::Unbind()
//glBindBuffer(GL_ARRAY_BUFFER, 0);
/* Or: */
//glDisableVertexAttribArray(m_attrib);
#else
/* Or even: */
//glDisableClientState(GL_VERTEX_ARRAY);
#endif


+ 77
- 0
src/lol/math/trig.h View File

@@ -0,0 +1,77 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

//
// Trigonometry functions
// ----------------------
//

#if !defined __LOL_MATH_TRIG_H__
#define __LOL_MATH_TRIG_H__

#include <cstdio>
#include <stdint.h>

namespace lol
{

/* Standard cmath functions */
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 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); }

static inline double atan2(double const &y, double const &x)
{
return std::atan2(y, x);
}

static inline float atan2(float const &y, float const &x)
{
return std::atan2(y, x);
}

/* Our extensions */
static inline void sincos(double const &x, double *s, double *c)
{
*s = std::sin(x);
*c = std::cos(x);
}

static inline void sincos(float const &x, float *s, float *c)
{
*s = std::sin(x);
*c = std::cos(x);
}

/* These accelerated functions will be merged into the above, one day */
double lol_sin(double);
double lol_cos(double);
double lol_tan(double);
void lol_sincos(double, double*, double*);
void lol_sincos(float, float*, float*);
double lol_asin(double);
double lol_acos(double);
double lol_atan(double);
double lol_atan2(double, double);

} /* namespace lol */

#endif // __LOL_MATH_TRIG_H__


+ 0
- 38
src/math/trig.h View File

@@ -1,38 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/projects/COPYING.WTFPL for more details.
//

//
// Trigonometry functions
// ----------------------
//

#if !defined __LOL_TRIG_H__
#define __LOL_TRIG_H__

#include <cstdio>
#include <stdint.h>

namespace lol
{

double lol_sin(double);
double lol_cos(double);
double lol_tan(double);
void lol_sincos(double, double*, double*);
void lol_sincos(float, float*, float*);
double lol_asin(double);
double lol_acos(double);
double lol_atan(double);
double lol_atan2(double, double);

} /* namespace lol */

#endif // __LOL_TRIG_H__


+ 6
- 14
src/math/vector.cpp View File

@@ -340,8 +340,8 @@ template<> mat2 mat2::rotate(float angle)
{
angle *= (M_PI / 180.0f);

float st = std::sin(angle);
float ct = std::cos(angle);
float st = sin(angle);
float ct = cos(angle);

mat2 ret;

@@ -358,8 +358,8 @@ template<> mat3 mat3::rotate(float angle, float x, float y, float z)
{
angle *= (M_PI / 180.0f);

float st = std::sin(angle);
float ct = std::cos(angle);
float st = sin(angle);
float ct = cos(angle);

float len = std::sqrt(x * x + y * y + z * z);
float invlen = len ? 1.0f / len : 0.0f;
@@ -477,9 +477,9 @@ template<> quat quat::rotate(float angle, vec3 const &v)
{
angle *= (M_PI / 360.0f);

vec3 tmp = normalize(v) * std::sin(angle);
vec3 tmp = normalize(v) * sin(angle);

return quat(std::cos(angle), tmp.x, tmp.y, tmp.z);
return quat(cos(angle), tmp.x, tmp.y, tmp.z);
}

template<> quat quat::rotate(float angle, float x, float y, float z)
@@ -489,9 +489,6 @@ template<> quat quat::rotate(float angle, float x, float y, float z)

template<> vec3 vec3::toeuler(quat const &q)
{
using std::atan2;
using std::asin;

float n = norm(q);

if (!n)
@@ -508,8 +505,6 @@ template<> vec3 vec3::toeuler(quat const &q)

static inline mat3 mat3_fromeuler_generic(vec3 const &v, int i, int j, int k)
{
using std::sin;
using std::cos;
mat3 ret;

vec3 radians = (M_PI / 180.0f) * v;
@@ -578,9 +573,6 @@ static inline mat3 mat3_fromeuler_generic(vec3 const &v, int i, int j, int k)

static inline quat quat_fromeuler_generic(vec3 const &v, int i, int j, int k)
{
using std::sin;
using std::cos;

vec3 half_angles = (M_PI / 360.0f) * v;
float s0 = sin(half_angles[0]), c0 = cos(half_angles[0]);
float s1 = sin(half_angles[1]), c1 = cos(half_angles[1]);


+ 3
- 4
test/tutorial/03_fractal.cpp View File

@@ -19,7 +19,6 @@
#include "lolgl.h"
#include "loldebug.h"

using namespace std;
using namespace lol;

#if defined _WIN32 && defined USE_D3D9
@@ -236,7 +235,7 @@ public:
m_drag = false;
if (m_translate != 0.0)
{
m_translate *= pow(2.0, -seconds * 5.0);
m_translate *= std::pow(2.0, -seconds * 5.0);
if (m_translate.norm() / m_radius < 1e-4)
m_translate = 0.0;
}
@@ -251,7 +250,7 @@ public:
}
else if (m_zoom_speed)
{
m_zoom_speed *= pow(2.0, -seconds * 5.0);
m_zoom_speed *= std::pow(2.0, -seconds * 5.0);
if (abs(m_zoom_speed) < 1e-5 || m_drag)
m_zoom_speed = 0.0;
}
@@ -261,7 +260,7 @@ public:
{
dcmplx oldcenter = m_center;
double oldradius = m_radius;
double zoom = pow(2.0, seconds * 1e3f * m_zoom_speed);
double zoom = std::pow(2.0, seconds * 1e3f * m_zoom_speed);
if (m_radius * zoom > 8.0)
{
m_zoom_speed *= -1.0;


+ 11
- 16
test/unit/trig.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
// This program is free software; you can redistribute it and/or
// modify it under the terms of the Do What The Fuck You Want To
// Public License, Version 2, as published by Sam Hocevar. See
@@ -25,7 +25,6 @@ LOLUNIT_FIXTURE(TrigTest)
LOLUNIT_TEST(Sin)
{
using std::fabs;
using std::sin;

for (int i = -10000; i < 10000; i++)
{
@@ -33,7 +32,7 @@ LOLUNIT_FIXTURE(TrigTest)
#if defined __GNUC__
double a = __builtin_sin(f);
#else
double a = sin(f);
double a = std::sin(f);
#endif
double b = lol_sin(f);
LOLUNIT_SET_CONTEXT(f);
@@ -46,7 +45,7 @@ LOLUNIT_FIXTURE(TrigTest)
#if defined __GNUC__
double a = __builtin_sin(f);
#else
double a = sin(f);
double a = std::sin(f);
#endif
double b = lol_sin(f);
LOLUNIT_SET_CONTEXT(f);
@@ -57,7 +56,6 @@ LOLUNIT_FIXTURE(TrigTest)
LOLUNIT_TEST(Cos)
{
using std::fabs;
using std::cos;

for (int i = -10000; i < 10000; i++)
{
@@ -65,7 +63,7 @@ LOLUNIT_FIXTURE(TrigTest)
#if defined __GNUC__
double a = __builtin_cos(f);
#else
double a = cos(f);
double a = std::cos(f);
#endif
double b = lol_cos(f);
LOLUNIT_SET_CONTEXT(f);
@@ -78,7 +76,7 @@ LOLUNIT_FIXTURE(TrigTest)
#if defined __GNUC__
double a = __builtin_cos(f);
#else
double a = cos(f);
double a = std::cos(f);
#endif
double b = lol_cos(f);
LOLUNIT_SET_CONTEXT(f);
@@ -89,8 +87,6 @@ LOLUNIT_FIXTURE(TrigTest)
LOLUNIT_TEST(SinCos)
{
using std::fabs;
using std::sin;
using std::cos;

for (int i = -10000; i < 10000; i++)
{
@@ -99,8 +95,8 @@ LOLUNIT_FIXTURE(TrigTest)
double a1 = __builtin_sin(f);
double a2 = __builtin_cos(f);
#else
double a1 = sin(f);
double a2 = cos(f);
double a1 = std::sin(f);
double a2 = std::cos(f);
#endif
double b1, b2;
lol_sincos(f, &b1, &b2);
@@ -116,8 +112,8 @@ LOLUNIT_FIXTURE(TrigTest)
double a1 = __builtin_sin(f);
double a2 = __builtin_cos(f);
#else
double a1 = sin(f);
double a2 = cos(f);
double a1 = std::sin(f);
double a2 = std::cos(f);
#endif
double b1, b2;
lol_sincos(f, &b1, &b2);
@@ -130,7 +126,6 @@ LOLUNIT_FIXTURE(TrigTest)
LOLUNIT_TEST(Tan)
{
using std::fabs;
using std::tan;

for (int i = -100000; i < 100000; i++)
{
@@ -138,7 +133,7 @@ LOLUNIT_FIXTURE(TrigTest)
#if defined __GNUC__
double a = __builtin_tan(f);
#else
double a = tan(f);
double a = std::tan(f);
#endif
double b = lol_tan(f);
LOLUNIT_SET_CONTEXT(f);
@@ -156,7 +151,7 @@ LOLUNIT_FIXTURE(TrigTest)
#if defined __GNUC__
double a = __builtin_tan(f);
#else
double a = tan(f);
double a = std::tan(f);
#endif
double b = lol_tan(f);
LOLUNIT_SET_CONTEXT(f);


+ 1
- 2
test/xolotl/xolotl.cpp View File

@@ -17,7 +17,6 @@
#include "lolgl.h"
#include "loldebug.h"

using namespace std;
using namespace lol;

#if USE_SDL && defined __APPLE__
@@ -70,7 +69,7 @@ int main(int argc, char **argv)
/* Register some debug stuff */
new DebugFps(5, 5);

Cell<3> c;
Cell<3> c;
app.Run();

return EXIT_SUCCESS;


+ 2
- 2
win32/lolcore.vcxproj View File

@@ -174,10 +174,10 @@
<ClInclude Include="..\src\lol\math\half.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" />
<ClInclude Include="..\src\math\trig.h" />
<ClInclude Include="..\src\numeric.h" />
<ClInclude Include="..\src\platform.h" />
<ClInclude Include="..\src\platform\d3d9\d3d9input.h" />
@@ -216,4 +216,4 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\Lol.Fx.targets" />
</ImportGroup>
</Project>
</Project>

+ 4
- 4
win32/lolcore.vcxproj.filters View File

@@ -261,9 +261,6 @@
<ClInclude Include="..\src\platform\sdl\sdlapp.h">
<Filter>src\platform\sdl</Filter>
</ClInclude>
<ClInclude Include="..\src\math\trig.h">
<Filter>src\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\half.h">
<Filter>src\lol\math</Filter>
</ClInclude>
@@ -273,6 +270,9 @@
<ClInclude Include="..\src\lol\math\remez.h">
<Filter>src\lol\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\trig.h">
<Filter>src\lol\math</Filter>
</ClInclude>
<ClInclude Include="..\src\lol\math\vector.h">
<Filter>src\lol\math</Filter>
</ClInclude>
@@ -464,4 +464,4 @@
<Filter>src\easymesh</Filter>
</None>
</ItemGroup>
</Project>
</Project>

Loading…
Cancel
Save