diff options
author | Micky <micheledevita2@gmail.com> | 2022-09-05 14:05:50 +0200 |
---|---|---|
committer | Micky <micheledevita2@gmail.com> | 2022-09-06 07:19:20 +0200 |
commit | b6daad8d4b4f828848e8ed778778e11ff92894dd (patch) | |
tree | f19ef0292c7c7071f859942bd9b9c7a02a17e468 /core | |
parent | 6c818da55ef1f45eaed06e1413220af1d23a9c41 (diff) |
Rename `range_lerp` to `remap`
Diffstat (limited to 'core')
-rw-r--r-- | core/math/math_funcs.h | 4 | ||||
-rw-r--r-- | core/variant/variant_utility.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index cae76b182a..656fc9f798 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -371,8 +371,8 @@ public: static _ALWAYS_INLINE_ double inverse_lerp(double p_from, double p_to, double p_value) { return (p_value - p_from) / (p_to - p_from); } static _ALWAYS_INLINE_ float inverse_lerp(float p_from, float p_to, float p_value) { return (p_value - p_from) / (p_to - p_from); } - static _ALWAYS_INLINE_ double range_lerp(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); } - static _ALWAYS_INLINE_ float range_lerp(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); } + static _ALWAYS_INLINE_ double remap(double p_value, double p_istart, double p_istop, double p_ostart, double p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); } + static _ALWAYS_INLINE_ float remap(float p_value, float p_istart, float p_istop, float p_ostart, float p_ostop) { return Math::lerp(p_ostart, p_ostop, Math::inverse_lerp(p_istart, p_istop, p_value)); } static _ALWAYS_INLINE_ double smoothstep(double p_from, double p_to, double p_s) { if (is_equal_approx(p_from, p_to)) { diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp index 1be17405c7..7ff64c88f0 100644 --- a/core/variant/variant_utility.cpp +++ b/core/variant/variant_utility.cpp @@ -393,8 +393,8 @@ struct VariantUtilityFunctions { return Math::inverse_lerp(from, to, weight); } - static inline double range_lerp(double value, double istart, double istop, double ostart, double ostop) { - return Math::range_lerp(value, istart, istop, ostart, ostop); + static inline double remap(double value, double istart, double istop, double ostart, double ostop) { + return Math::remap(value, istart, istop, ostart, ostop); } static inline double smoothstep(double from, double to, double val) { @@ -1434,7 +1434,7 @@ void Variant::_register_variant_utility_functions() { FUNCBINDR(bezier_interpolate, sarray("start", "control_1", "control_2", "end", "t"), Variant::UTILITY_FUNC_TYPE_MATH); FUNCBINDR(lerp_angle, sarray("from", "to", "weight"), Variant::UTILITY_FUNC_TYPE_MATH); FUNCBINDR(inverse_lerp, sarray("from", "to", "weight"), Variant::UTILITY_FUNC_TYPE_MATH); - FUNCBINDR(range_lerp, sarray("value", "istart", "istop", "ostart", "ostop"), Variant::UTILITY_FUNC_TYPE_MATH); + FUNCBINDR(remap, sarray("value", "istart", "istop", "ostart", "ostop"), Variant::UTILITY_FUNC_TYPE_MATH); FUNCBINDR(smoothstep, sarray("from", "to", "x"), Variant::UTILITY_FUNC_TYPE_MATH); FUNCBINDR(move_toward, sarray("from", "to", "delta"), Variant::UTILITY_FUNC_TYPE_MATH); |