summaryrefslogtreecommitdiff
path: root/core/variant/variant_utility.cpp
diff options
context:
space:
mode:
authorSilc 'Tokage' Renew <tokage.it.lab@gmail.com>2021-10-15 22:25:00 +0900
committerSilc 'Tokage' Renew <tokage.it.lab@gmail.com>2021-11-03 13:39:33 +0900
commit953a7bce7edf289dd8d2a1a6c8ecd8105380c8da (patch)
treea460d22509538abda5248c0b3ea7dc96d054b638 /core/variant/variant_utility.cpp
parentaf80bc8abecc30c77901967281679e380fb9f952 (diff)
reimplement ping-pong
Diffstat (limited to 'core/variant/variant_utility.cpp')
-rw-r--r--core/variant/variant_utility.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 666b582e39..e89bdd4faa 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -275,6 +275,10 @@ struct VariantUtilityFunctions {
return Math::wrapf(value, min, max);
}
+ static inline double pingpong(double value, double length) {
+ return Math::pingpong(value, length);
+ }
+
static inline Variant max(const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
if (p_argcount < 2) {
r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
@@ -1226,6 +1230,7 @@ void Variant::_register_variant_utility_functions() {
FUNCBINDR(clampf, sarray("value", "min", "max"), Variant::UTILITY_FUNC_TYPE_MATH);
FUNCBINDR(nearest_po2, sarray("value"), Variant::UTILITY_FUNC_TYPE_MATH);
+ FUNCBINDR(pingpong, sarray("value", "length"), Variant::UTILITY_FUNC_TYPE_MATH);
// Random