mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-03 07:16:31 -04:00
Avoid zero division during animation interpolation
This commit is contained in:
parent
93cb69b012
commit
4a0c998f53
@ -112,7 +112,12 @@ namespace NifOsg
|
||||
mLastHighKey = it;
|
||||
mLastLowKey = --it;
|
||||
|
||||
float a = (time - mLastLowKey->first) / (mLastHighKey->first - mLastLowKey->first);
|
||||
const float highTime = mLastHighKey->first;
|
||||
const float lowTime = mLastLowKey->first;
|
||||
if (highTime == lowTime)
|
||||
return mLastLowKey->second.mValue;
|
||||
|
||||
const float a = (time - lowTime) / (highTime - lowTime);
|
||||
|
||||
return interpolate(mLastLowKey->second, mLastHighKey->second, a, mKeys->mInterpolationType);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user