Use standard library functions for llisnan and replace obvious NaN checks that don't work using /fp:fast floating point behavior under MSVC
parent
c836a19aa8
commit
9d3fede2c5
|
|
@ -552,12 +552,12 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
|
||||||
|
|
||||||
mLastSex = avatar_sex;
|
mLastSex = avatar_sex;
|
||||||
|
|
||||||
// Check for NaN condition (NaN is detected if a variable doesn't equal itself.
|
// Check for NaN condition
|
||||||
if (mCurWeight != mCurWeight)
|
if (llisnan(mCurWeight))
|
||||||
{
|
{
|
||||||
mCurWeight = 0.0;
|
mCurWeight = 0.f;
|
||||||
}
|
}
|
||||||
if (mLastWeight != mLastWeight)
|
if (llisnan(mLastWeight))
|
||||||
{
|
{
|
||||||
mLastWeight = mCurWeight+.001f;
|
mLastWeight = mCurWeight+.001f;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,18 +39,8 @@
|
||||||
// llcommon depend on llmath.
|
// llcommon depend on llmath.
|
||||||
#include "is_approx_equal_fraction.h"
|
#include "is_approx_equal_fraction.h"
|
||||||
|
|
||||||
// work around for Windows & older gcc non-standard function names.
|
#define llisnan(val) std::isnan(val)
|
||||||
#if LL_WINDOWS
|
#define llfinite(val) std::isfinite(val)
|
||||||
#include <float.h>
|
|
||||||
#define llisnan(val) _isnan(val)
|
|
||||||
#define llfinite(val) _finite(val)
|
|
||||||
#elif (LL_LINUX && __GNUC__ <= 2)
|
|
||||||
#define llisnan(val) isnan(val)
|
|
||||||
#define llfinite(val) isfinite(val)
|
|
||||||
#else
|
|
||||||
#define llisnan(val) std::isnan(val)
|
|
||||||
#define llfinite(val) std::isfinite(val)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Single Precision Floating Point Routines
|
// Single Precision Floating Point Routines
|
||||||
// (There used to be more defined here, but they appeared to be redundant and
|
// (There used to be more defined here, but they appeared to be redundant and
|
||||||
|
|
|
||||||
|
|
@ -652,18 +652,17 @@ bool LLPhysicsMotion::onUpdate(F32 time)
|
||||||
velocity_new_local = 0;
|
velocity_new_local = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for NaN values. A NaN value is detected if the variables doesn't equal itself.
|
// Check for NaN values. If NaN, then reset everything.
|
||||||
// If NaN, then reset everything.
|
if (llisnan(mPosition_local) ||
|
||||||
if ((mPosition_local != mPosition_local) ||
|
llisnan(mVelocity_local) ||
|
||||||
(mVelocity_local != mVelocity_local) ||
|
llisnan(position_new_local))
|
||||||
(position_new_local != position_new_local))
|
|
||||||
{
|
{
|
||||||
position_new_local = 0;
|
position_new_local = 0.f;
|
||||||
mVelocity_local = 0;
|
mVelocity_local = 0.f;
|
||||||
mVelocityJoint_local = 0;
|
mVelocityJoint_local = 0.f;
|
||||||
mAccelerationJoint_local = 0;
|
mAccelerationJoint_local = 0.f;
|
||||||
mPosition_local = 0;
|
mPosition_local = 0.f;
|
||||||
mPosition_world = LLVector3(0,0,0);
|
mPosition_world = LLVector3(0.f,0.f,0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
const F32 position_new_local_clamped = llclamp(position_new_local,
|
const F32 position_new_local_clamped = llclamp(position_new_local,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue