LWO: Fix division by zero

pull/794/head
Turo Lamminen 2016-02-13 23:37:08 +02:00
parent 322c959424
commit b71bd3df84
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; break;
} }
// linear interpolation - default // 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;
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------