diff --git a/DebugUtils/Include/DebugDraw.h b/DebugUtils/Include/DebugDraw.h index 712c3f9..81c8c2a 100644 --- a/DebugUtils/Include/DebugDraw.h +++ b/DebugUtils/Include/DebugDraw.h @@ -19,6 +19,9 @@ #ifndef DEBUGDRAW_H #define DEBUGDRAW_H +// Some math headers don't have PI defined. +static const float DU_PI = 3.14159265f; + enum duDebugDrawPrimitives { DU_DRAW_POINTS, diff --git a/DebugUtils/Source/DebugDraw.cpp b/DebugUtils/Source/DebugDraw.cpp index 5bd6043..d794c66 100644 --- a/DebugUtils/Source/DebugDraw.cpp +++ b/DebugUtils/Source/DebugDraw.cpp @@ -169,7 +169,7 @@ void duAppendCylinderWire(struct duDebugDraw* dd, float minx, float miny, float init = true; 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+1] = sinf(a); } @@ -425,7 +425,7 @@ void duAppendCircle(struct duDebugDraw* dd, const float x, const float y, const init = true; 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+1] = sinf(a); } diff --git a/DebugUtils/Source/RecastDebugDraw.cpp b/DebugUtils/Source/RecastDebugDraw.cpp index e986584..52861e1 100644 --- a/DebugUtils/Source/RecastDebugDraw.cpp +++ b/DebugUtils/Source/RecastDebugDraw.cpp @@ -57,7 +57,7 @@ void duDebugDrawTriMeshSlope(duDebugDraw* dd, const float* verts, int /*nverts*/ if (!tris) 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); for (int i = 0; i < ntris*3; i += 3) diff --git a/Recast/Include/Recast.h b/Recast/Include/Recast.h index 5fc8d89..1fd5dc2 100644 --- a/Recast/Include/Recast.h +++ b/Recast/Include/Recast.h @@ -19,6 +19,9 @@ #ifndef RECAST_H #define RECAST_H +// Some math headers don't have PI defined. +static const float RC_PI = 3.14159265f; + enum rcLogCategory { RC_LOG_PROGRESS = 1, diff --git a/Recast/Source/Recast.cpp b/Recast/Source/Recast.cpp index 369e1ee..d051418 100644 --- a/Recast/Source/Recast.cpp +++ b/Recast/Source/Recast.cpp @@ -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. // rcAssert(ctx); - const float walkableThr = cosf(walkableSlopeAngle/180.0f*(float)M_PI); + const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI); 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. // rcAssert(ctx); - const float walkableThr = cosf(walkableSlopeAngle/180.0f*(float)M_PI); + const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI); float norm[3];