diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2022-07-29 04:55:10 +0900 |
---|---|---|
committer | Silc Renew <tokage.it.lab@gmail.com> | 2022-08-19 14:48:37 +0900 |
commit | dded7c72c1d3ceff45c7c5279d430e4622e32da9 (patch) | |
tree | b2529e3d03d1471238f708dad2a35f34ab4d9f21 /core/math/vector4.cpp | |
parent | 0ba1046355b689d33eeed13a2633b174d62ccff8 (diff) |
Make `cubic_interpolate()` consider key time in animation
Diffstat (limited to 'core/math/vector4.cpp')
-rw-r--r-- | core/math/vector4.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/math/vector4.cpp b/core/math/vector4.cpp index 1dd5adad2b..273a111891 100644 --- a/core/math/vector4.cpp +++ b/core/math/vector4.cpp @@ -138,6 +138,15 @@ Vector4 Vector4::cubic_interpolate(const Vector4 &p_b, const Vector4 &p_pre_a, c return res; } +Vector4 Vector4::cubic_interpolate_in_time(const Vector4 &p_b, const Vector4 &p_pre_a, const Vector4 &p_post_b, const real_t p_weight, const real_t &p_b_t, const real_t &p_pre_a_t, const real_t &p_post_b_t) const { + Vector4 res = *this; + res.x = Math::cubic_interpolate_in_time(res.x, p_b.x, p_pre_a.x, p_post_b.x, p_weight, p_b_t, p_pre_a_t, p_post_b_t); + res.y = Math::cubic_interpolate_in_time(res.y, p_b.y, p_pre_a.y, p_post_b.y, p_weight, p_b_t, p_pre_a_t, p_post_b_t); + res.z = Math::cubic_interpolate_in_time(res.z, p_b.z, p_pre_a.z, p_post_b.z, p_weight, p_b_t, p_pre_a_t, p_post_b_t); + res.w = Math::cubic_interpolate_in_time(res.w, p_b.w, p_pre_a.w, p_post_b.w, p_weight, p_b_t, p_pre_a_t, p_post_b_t); + return res; +} + Vector4 Vector4::posmod(const real_t p_mod) const { return Vector4(Math::fposmod(x, p_mod), Math::fposmod(y, p_mod), Math::fposmod(z, p_mod), Math::fposmod(w, p_mod)); } |