1#define_import_path bevy_water::water_functions 4#import bevy_render::globals::Globals 5@group(0) @binding(1) var<uniform> globals: Globals; 7#import bevy_pbr::mesh_view_bindings::globals 10#import bevy_water::water_bindings::material 11#import bevy_water::noise; 13fn wave(p: vec2<f32>) -> f32 { 14 let time = globals.time * .5 + 23.0; 16 let time_x = time / 1.0; 17 let time_y = time / 0.5; 20 let wave_x = cos(p.x / wave_len_x + time_x); 21 let wave_y = smoothstep(1.0, 0.0, abs(sin(p.y / wave_len_y + wave_x + time_y))); 23 let n = noise::fbm::fbm_half(p) / 2.0 - 1.0; 25 let n = noise::fbm::fbm(p) / 2.0 - 1.0; 30fn get_wave_height(p: vec2<f32>) -> f32 { 31 let time = globals.time / 2.0; 32 var d = wave((p - time) * 0.3) * 0.3; 34 d = d + wave((p + time) * 0.4) * 0.3; 37 d = d + wave((p + time) * 0.5) * 0.2; 40 d = d + wave((p - time) * 0.6) * 0.2; 42 return material.amplitude * d; 45fn uv_to_coord(uv: vec2<f32>) -> vec2<f32> { 46 return material.coord_offset + (uv * material.coord_scale);