Fix for Issue 128 (third time the charm)

This commit is contained in:
Mikko Mononen 2010-10-10 10:15:44 +00:00
parent e441eca3c4
commit f5c3a8b609
5 changed files with 11 additions and 5 deletions

View File

@ -19,6 +19,9 @@
#ifndef DEBUGDRAW_H #ifndef DEBUGDRAW_H
#define DEBUGDRAW_H #define DEBUGDRAW_H
// Some math headers don't have PI defined.
static const float DU_PI = 3.14159265f;
enum duDebugDrawPrimitives enum duDebugDrawPrimitives
{ {
DU_DRAW_POINTS, DU_DRAW_POINTS,

View File

@ -169,7 +169,7 @@ void duAppendCylinderWire(struct duDebugDraw* dd, float minx, float miny, float
init = true; init = true;
for (int i = 0; i < NUM_SEG; ++i) for (int i = 0; i < NUM_SEG; ++i)
{ {
const float a = (float)i/(float)NUM_SEG*(float)M_PI*2; const float a = (float)i/(float)NUM_SEG*DU_PI*2;
dir[i*2] = cosf(a); dir[i*2] = cosf(a);
dir[i*2+1] = sinf(a); dir[i*2+1] = sinf(a);
} }
@ -425,7 +425,7 @@ void duAppendCircle(struct duDebugDraw* dd, const float x, const float y, const
init = true; init = true;
for (int i = 0; i < NUM_SEG; ++i) for (int i = 0; i < NUM_SEG; ++i)
{ {
const float a = (float)i/(float)NUM_SEG*(float)M_PI*2; const float a = (float)i/(float)NUM_SEG*DU_PI*2;
dir[i*2] = cosf(a); dir[i*2] = cosf(a);
dir[i*2+1] = sinf(a); dir[i*2+1] = sinf(a);
} }

View File

@ -57,7 +57,7 @@ void duDebugDrawTriMeshSlope(duDebugDraw* dd, const float* verts, int /*nverts*/
if (!tris) return; if (!tris) return;
if (!normals) return; if (!normals) return;
const float walkableThr = cosf(walkableSlopeAngle/180.0f*(float)M_PI); const float walkableThr = cosf(walkableSlopeAngle/180.0f*DU_PI);
dd->begin(DU_DRAW_TRIS); dd->begin(DU_DRAW_TRIS);
for (int i = 0; i < ntris*3; i += 3) for (int i = 0; i < ntris*3; i += 3)

View File

@ -19,6 +19,9 @@
#ifndef RECAST_H #ifndef RECAST_H
#define RECAST_H #define RECAST_H
// Some math headers don't have PI defined.
static const float RC_PI = 3.14159265f;
enum rcLogCategory enum rcLogCategory
{ {
RC_LOG_PROGRESS = 1, RC_LOG_PROGRESS = 1,

View File

@ -200,7 +200,7 @@ void rcMarkWalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAngle,
// TODO: VC complains about unref formal variable, figure out a way to handle this better. // TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx); // rcAssert(ctx);
const float walkableThr = cosf(walkableSlopeAngle/180.0f*(float)M_PI); const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
float norm[3]; float norm[3];
@ -222,7 +222,7 @@ void rcClearUnwalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAng
// TODO: VC complains about unref formal variable, figure out a way to handle this better. // TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx); // rcAssert(ctx);
const float walkableThr = cosf(walkableSlopeAngle/180.0f*(float)M_PI); const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
float norm[3]; float norm[3];