Fix gltf_animation for cubic interpolation when time is outside bounds
This commit is contained in:
parent
0019063c4e
commit
5630ae2da3
1 changed files with 12 additions and 2 deletions
|
|
@ -112,9 +112,19 @@ namespace psemek::gfx
|
||||||
{
|
{
|
||||||
auto it = std::lower_bound(input_.begin(), input_.end(), time);
|
auto it = std::lower_bound(input_.begin(), input_.end(), time);
|
||||||
if (it == input_.begin())
|
if (it == input_.begin())
|
||||||
return output_.front();
|
{
|
||||||
|
if (interpolation_ == geom::easing_type::cubic)
|
||||||
|
return output_[1];
|
||||||
|
else
|
||||||
|
return output_.front();
|
||||||
|
}
|
||||||
if (it == input_.end())
|
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();
|
auto i = it - input_.begin();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue