Merge pull request #794 from turol/master

LWO: Fix division by zero
pull/796/head
Alexander Gessler 2016-02-13 22:51:54 +01:00
commit 4866191b21
1 changed files with 6 additions and 1 deletions

View File

@ -328,7 +328,12 @@ void AnimResolver::DoInterpolation2(std::vector<LWO::Key>::const_iterator beg,
break;
}
// linear interpolation - default
fill = (*beg).value + ((*end).value - (*beg).value)*(float)(((time - (*beg).time) / ((*end).time - (*beg).time)));
double duration = (*end).time - (*beg).time;
if (duration > 0.0) {
fill = (*beg).value + ((*end).value - (*beg).value)*(float)(((time - (*beg).time) / duration));
} else {
fill = (*beg).value;
}
}
// ------------------------------------------------------------------------------------------------