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.

Constants

LOD_COUNT

#
const LOD_COUNT: u32 = 5u

CASCADE_COUNT

#
const CASCADE_COUNT: u32 = LOD_COUNT + 1u

WAVE_COUNT

#
const WAVE_COUNT: u32 = 40u

TAU

#
const TAU: f32 = 6.283185307179586

PI

#
const PI: f32 = 3.141592653589793

NO_BED_DEPTH

#
const NO_BED_DEPTH: f32 = 256.0

Bindings

output

#
@group(0)
@binding(0)
var output: texture_storage_2d_array<rgba16float, write>

params

#
@group(0)
@binding(1)
var<uniform> params: AnimWavesUniform

bed_height

#
@group(0)
@binding(2)
var bed_height: texture_2d<f32>

Structures

CascadeParams

#
struct CascadeParams {
center: vec2<f32>,
scale: f32,
texture_res: f32,
inv_texture_res: f32,
texel_width: f32,
weight: f32,
max_wavelength: f32,
}

CascadeLayout

#
struct CascadeLayout {
cascades: array<CascadeParams, CASCADE_COUNT>,
center: vec4<f32>,
bed_transform: vec4<f32>,
bed_range: vec4<f32>,
}

GerstnerWave

#
struct GerstnerWave {
direction: vec2<f32>,
amplitude: f32,
wave_number: f32,
angular_frequency: f32,
phase: f32,
chop_amplitude: f32,
}

AnimWavesUniform

#
struct AnimWavesUniform {
cascade_layout: CascadeLayout,
waves: array<GerstnerWave, WAVE_COUNT>,
ranges: array<vec4<u32>, LOD_COUNT>,
time: vec4<f32>,
flow: vec4<f32>,
}

Functions

bed_water_depth

#

Water depth under the sea level from the game’s bed height map. Outside the mapped area (or with no map at all) the sample keeps the deep default, mirroring a full-depth capture texel. Nearest-texel read: the shoaling profile is smooth enough that one 5 m-class bed texel suffices.

fn bed_water_depth (
world_xz: vec2<f32>
) -> f32

shoaling_weights

#

A bounded finite-depth shoaling profile. The vertical lane retains more energy than horizontal chop through the breaker zone, producing steeper near-shore crests without changing deep-water phase or world anchoring.

fn shoaling_weights (
depth: f32,
wave_number: f32
) -> vec2<f32>

generate

#
@compute
Runs custom parallel code on the GPU, not limited to graphics
@workgroup_size(8, 8, 1)
Defines the size of a thread group. One to three numbers: width (x), height (y), and depth (z). Missing values default to 1
fn generate (
@builtin(global_invocation_id)
id: vec3<u32>
)
Contents