From 514a3fb96a6ad97eb9488cacba7143566cb17d27 Mon Sep 17 00:00:00 2001 From: Chaosus Date: Tue, 19 Mar 2019 14:39:43 +0300 Subject: Added smoothstep built-in function --- modules/mono/glue/Managed/Files/Mathf.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules/mono/glue/Managed') diff --git a/modules/mono/glue/Managed/Files/Mathf.cs b/modules/mono/glue/Managed/Files/Mathf.cs index 5f5de12959..a064278237 100644 --- a/modules/mono/glue/Managed/Files/Mathf.cs +++ b/modules/mono/glue/Managed/Files/Mathf.cs @@ -261,6 +261,16 @@ namespace Godot return (real_t)Math.Sinh(s); } + public static real_t SmoothStep(real_t from, real_t to, real_t weight) + { + if (IsEqualApprox(from, to)) + { + return from; + } + real_t x = Clamp((weight - from) / (to - from), (real_t)0.0, (real_t)1.0); + return x * x * (3 - 2 * x); + } + public static real_t Sqrt(real_t s) { return (real_t)Math.Sqrt(s); -- cgit v1.2.3