diff options
author | Chaosus <chaosus89@gmail.com> | 2019-03-19 14:39:43 +0300 |
---|---|---|
committer | Chaosus <chaosus89@gmail.com> | 2019-04-07 14:11:26 +0300 |
commit | 514a3fb96a6ad97eb9488cacba7143566cb17d27 (patch) | |
tree | 0c8e73449cf64330212c2ced522939753f719f03 /modules/mono/glue/Managed | |
parent | df7d3708c5b535c3696943322a14ec19a175e30c (diff) |
Added smoothstep built-in function
Diffstat (limited to 'modules/mono/glue/Managed')
-rw-r--r-- | modules/mono/glue/Managed/Files/Mathf.cs | 10 |
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); |