Skip to content

Commit

Permalink
LWO: Fix division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
turol committed Feb 13, 2016
1 parent 322c959 commit b71bd3d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion code/LWOAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

// ------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit b71bd3d

Please sign in to comment.