summaryrefslogtreecommitdiff
path: root/modules/mono/glue/Managed
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-04-08 10:03:42 +0200
committerGitHub <noreply@github.com>2019-04-08 10:03:42 +0200
commitd211aff777ec338a5f57cece1c7bf76120d0622d (patch)
treec7d6a922eb7e7a5dd3995c366848f39c82338220 /modules/mono/glue/Managed
parent5a64c679cfc5463afd4a703b1c6e437d894b22b1 (diff)
parent514a3fb96a6ad97eb9488cacba7143566cb17d27 (diff)
Merge pull request #27231 from Chaosus/smoothstep
Added smoothstep built-in function
Diffstat (limited to 'modules/mono/glue/Managed')
-rw-r--r--modules/mono/glue/Managed/Files/Mathf.cs10
1 files changed, 10 insertions, 0 deletions
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);