You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Added smoothstep built-in function
(cherry picked from commit 514a3fb96a)
This commit is contained in:
committed by
Hein-Pieter van Braam-Stewart
parent
340bf6e80c
commit
6ab01490f5
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user