// bevy_elements::terrain::common — the terrain grid's placement for shaders that read the packed
// `terrain_cells` buffer (wind solid mask, precipitation ground, ground extension, terrain and
// water materials).
//
// import bevy_elements::grid::grid_taps;
// import bevy_elements::terrain::common::{TerrainParams, terrain_live};
//
// `terrain_cells` is `array<vec4<f32>>`, one entry per cell, row-major: x surface height
// (bedrock + sediment, m above `misc.x`), y sediment depth (m), z water depth above the surface
// (m), w `bitcast<f32>(pack2x16float(∂h/∂x, ∂h/∂z))`. Sample it with `grid_taps(params.grid, xz)`
// and four loads; the world height is `misc.x + surface`.
import bevy_elements::grid::GridParams;
struct TerrainParams {
grid: GridParams,
// x: world height of a stored height of 0 (m). y: readback downsample factor.
// z: 1 when a terrain is bound, 0 when the binding is a one-cell placeholder.
misc: vec4<f32>,
}
fn terrain_live(params: TerrainParams) -> bool {
return params.misc.z > 0.5;
}