diff --git a/Externals/ode/include/ode/common.h b/Externals/ode/include/ode/common.h index c593ce67a63..91d50880a6b 100644 --- a/Externals/ode/include/ode/common.h +++ b/Externals/ode/include/ode/common.h @@ -26,6 +26,10 @@ #include #include +#ifdef LINUX +#include +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/Externals/ode/include/ode/config.h b/Externals/ode/include/ode/config.h index 6fbfa2feae7..8588ab2dbc2 100644 --- a/Externals/ode/include/ode/config.h +++ b/Externals/ode/include/ode/config.h @@ -23,7 +23,9 @@ /* per-machine configuration */ - +#ifdef LINUX +#include +#endif #ifndef _ODE_CONFIG_H_ diff --git a/Externals/ode/ode/src/StepJointInternal.h b/Externals/ode/ode/src/StepJointInternal.h index 2ac482a2bc6..07f24d2e0e8 100644 --- a/Externals/ode/ode/src/StepJointInternal.h +++ b/Externals/ode/ode/src/StepJointInternal.h @@ -1,4 +1,4 @@ #ifndef STEP_JOINT_INTERNAL_H #define STEP_JOINT_INTERNAL_H void dInternalStepJointContact (dxWorld * world, dxBody * body[2], dReal * GI[2], dReal * GinvI[2], dxJoint * joint, dxJoint::Info1 info, dxJoint::Info2 Jinfo, dReal stepsize); -#endif STEP_JOINT_INTERNAL_H \ No newline at end of file +#endif // STEP_JOINT_INTERNAL_H \ No newline at end of file diff --git a/Externals/ode/ode/src/error.cpp b/Externals/ode/ode/src/error.cpp index 9b33db55f0c..9e5e2fada3f 100644 --- a/Externals/ode/ode/src/error.cpp +++ b/Externals/ode/ode/src/error.cpp @@ -81,6 +81,7 @@ static void printMessage (int num, const char *msg1, const char *msg2, // unix #ifndef WIN32 +#include extern "C" void dError (int num, const char *msg, ...) { diff --git a/Externals/ode/ode/src/odemath.cpp b/Externals/ode/ode/src/odemath.cpp index 47da06c2da3..63c9a03c4f7 100644 --- a/Externals/ode/ode/src/odemath.cpp +++ b/Externals/ode/ode/src/odemath.cpp @@ -23,6 +23,7 @@ #include #include #include +#include // this may be called for vectors `a' with extremely small magnitude, for // example the result of a cross product on two nearly perpendicular vectors. @@ -51,7 +52,7 @@ void dNormalize3_slow (dVector3 a) a2 /= aa1; l = dRecipSqrt (a0*a0 + a2*a2 + 1); a[0] = a0*l; - a[1] = (dReal)_copysign(l,a1); + a[1] = (dReal)std::copysign(l,a1); a[2] = a2*l; } } @@ -63,7 +64,7 @@ void dNormalize3_slow (dVector3 a) l = dRecipSqrt (a0*a0 + a1*a1 + 1); a[0] = a0*l; a[1] = a1*l; - a[2] = (dReal)_copysign(l,a2); + a[2] = (dReal)std::copysign(l,a2); } else { // aa0 is largest if (aa0 <= 0) { @@ -76,7 +77,7 @@ void dNormalize3_slow (dVector3 a) a1 /= aa0; a2 /= aa0; l = dRecipSqrt (a1*a1 + a2*a2 + 1); - a[0] = (dReal)_copysign(l,a0); + a[0] = (dReal)std::copysign(l,a0); a[1] = a1*l; a[2] = a2*l; } diff --git a/Externals/ode/ode/src/util.h b/Externals/ode/ode/src/util.h index 96a636f7a3d..9572cd2c53a 100644 --- a/Externals/ode/ode/src/util.h +++ b/Externals/ode/ode/src/util.h @@ -25,6 +25,9 @@ #include "objects.h" #include "float.h" +#if defined(LINUX) +#include +#endif void dInternalHandleAutoDisabling (dxWorld *world, dReal stepsize); extern "C" @@ -37,19 +40,31 @@ typedef void (*dstepper_fn_t) (dxWorld *world, dxBody * const *body, int nb, void dxProcessIslands (dxWorld *world, dReal stepsize, dstepper_fn_t stepper); -inline bool dValid (const float x) +inline bool dValid(const float x) { - // check for: Signaling NaN, Quiet NaN, Negative infinity ( –INF), Positive infinity (+INF), Negative denormalized, Positive denormalized - int cls = _fpclass (double(x)); - if (cls&(_FPCLASS_SNAN+_FPCLASS_QNAN+_FPCLASS_NINF+_FPCLASS_PINF+_FPCLASS_ND+_FPCLASS_PD)) - return false; - - /* *****other cases are***** - _FPCLASS_NN Negative normalized non-zero - _FPCLASS_NZ Negative zero ( – 0) - _FPCLASS_PZ Positive 0 (+0) - _FPCLASS_PN Positive normalized non-zero - */ - return true; +#ifdef MSVC + // check for: Signaling NaN, Quiet NaN, Negative infinity (-INF), Positive infinity (+INF), Negative denormalized, Positive denormalized + int cls = _fpclass (double(x)); + if (cls&(_FPCLASS_SNAN+_FPCLASS_QNAN+_FPCLASS_NINF+_FPCLASS_PINF+_FPCLASS_ND+_FPCLASS_PD)) + return false; +#elif defined(LINUX) + int cls = std::fpclassify((double )x); + switch (cls) + { + case FP_NAN: + case FP_INFINITE: + case FP_SUBNORMAL: + return false; + default: + break; + } +#endif + /* *****other cases are***** + _FPCLASS_NN Negative normalized non-zero + _FPCLASS_NZ Negative zero (-0) + _FPCLASS_PZ Positive 0 (+0) + _FPCLASS_PN Positive normalized non-zero + */ + return true; } #endif