- collada: avoid unsafe float comparison against a magic number.
parent
0b9d6bec0d
commit
b4f666083a
|
@ -119,6 +119,7 @@ struct Camera
|
||||||
};
|
};
|
||||||
|
|
||||||
#define aiLightSource_AMBIENT 0xdeaddead
|
#define aiLightSource_AMBIENT 0xdeaddead
|
||||||
|
#define ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET 1e9f
|
||||||
|
|
||||||
/** A collada light source. */
|
/** A collada light source. */
|
||||||
struct Light
|
struct Light
|
||||||
|
@ -129,8 +130,8 @@ struct Light
|
||||||
, mAttQuadratic (0.f)
|
, mAttQuadratic (0.f)
|
||||||
, mFalloffAngle (180.f)
|
, mFalloffAngle (180.f)
|
||||||
, mFalloffExponent (0.f)
|
, mFalloffExponent (0.f)
|
||||||
, mPenumbraAngle (10e10f)
|
, mPenumbraAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET)
|
||||||
, mOuterAngle (10e10f)
|
, mOuterAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET)
|
||||||
, mIntensity (1.f)
|
, mIntensity (1.f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -325,11 +325,11 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
|
||||||
|
|
||||||
out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle );
|
out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle );
|
||||||
|
|
||||||
// ... some extension magic. O
|
// ... some extension magic.
|
||||||
if (srcLight->mOuterAngle == 10e10f)
|
if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f))
|
||||||
{
|
{
|
||||||
// ... some deprecation magic.
|
// ... some deprecation magic.
|
||||||
if (srcLight->mPenumbraAngle == 10e10f)
|
if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f))
|
||||||
{
|
{
|
||||||
// Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess ....
|
// Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess ....
|
||||||
// epsilon chosen to be 0.1
|
// epsilon chosen to be 0.1
|
||||||
|
|
Loading…
Reference in New Issue