(edge0: f32, edge1: f32, x: f32)
| 61 | } |
| 62 | |
| 63 | pub fn smoothstep(edge0: f32, edge1: f32, x: f32) -> f32 { |
| 64 | // Scale, bias and saturate x to 0..1 range |
| 65 | let x = saturate((x - edge0) / (edge1 - edge0)); |
| 66 | // Evaluate polynomial |
| 67 | x * x * (3.0 - 2.0 * x) |
| 68 | } |