fix division by zero.

pull/2966/head
Kim Kulling 2020-09-30 20:39:26 +02:00 committed by GitHub
parent 4affe21709
commit 0191c661b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -384,6 +384,9 @@ void ColladaLoader::BuildLightsForNode(const ColladaParser &pParser, const Colla
if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET * (1 - 1e-6f)) { 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
if ( 0.0f == srcLight->mFalloffExponent ) {
srcLight->mFalloffExponent = 1.0f;
}
out->mAngleOuterCone = std::acos(std::pow(0.1f, 1.f / srcLight->mFalloffExponent)) + out->mAngleOuterCone = std::acos(std::pow(0.1f, 1.f / srcLight->mFalloffExponent)) +
out->mAngleInnerCone; out->mAngleInnerCone;
} else { } else {