MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / smoothstep

Function smoothstep

examples/shaders/shared/src/lib.rs:63–68  ·  view source on GitHub ↗
(edge0: f32, edge1: f32, x: f32)

Source from the content-addressed store, hash-verified

61}
62
63pub 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}

Callers 3

fillMethod · 0.85
main_fsFunction · 0.85
skyFunction · 0.85

Calls 1

saturateFunction · 0.85

Tested by

no test coverage detected