Fix gltf_animation for cubic interpolation when time is outside bounds

This commit is contained in:
Nikita Lisitsa 2023-08-02 19:18:20 +03:00
parent 0019063c4e
commit 5630ae2da3

View file

@ -112,9 +112,19 @@ namespace psemek::gfx
{
auto it = std::lower_bound(input_.begin(), input_.end(), time);
if (it == input_.begin())
return output_.front();
{
if (interpolation_ == geom::easing_type::cubic)
return output_[1];
else
return output_.front();
}
if (it == input_.end())
return output_.back();
{
if (interpolation_ == geom::easing_type::cubic)
return output_[output_.size() - 2];
else
return output_.back();
}
auto i = it - input_.begin();