Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1#define_import_path bevy_water::noise::random
3fn random(v: f32) -> f32 {
4 return fract(sin(dot(vec2<f32>(v), vec2<f32>(12.9898,78.233))) * 43758.5453123);
5}
7fn random2d(v: vec2<f32>) -> f32 {
8 return fract(sin(dot(v, vec2<f32>(12.9898,78.233))) * 43758.5453123);
9}
11// Sometimes needed for noise functions that sample multiple corners.
12fn random2di(v: vec2<f32>) -> f32 {
13 return random2d(floor(v));
16fn cubic_hermite_curve(x: f32) -> f32 {
17 //y = x*x*(3.0-2.0*x);
18 return smoothstep(0., 1., x);
21fn cubic_hermite_curve_2d(x: vec2<f32>) -> vec2<f32> {
22 //y = x*x*(3.0-2.0*x);
23 return smoothstep(vec2<f32>(0.), vec2<f32>(1.), x);
Contents