code wiki / (root) / nx_beach_zone.nx

nx_beach_zone.nx

buildroot/runtime/nx_beach_zone.nx

16101 B305 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_beach_zone.nx -- specialized water-land transition generator. Third demonstration of the kind-specific-generator cardinal `feedback-kind-specific-generators-not-broad-noise` after nx_forest_layout (scattered features) and nx_river_carve (polyline path). Beach is the 3rd shape variant: BANDED ZONE -- a horizontal elevation band between water and upland. Beach-internal logic in v1: - Zone classification by elevation relative to water level: below water_level -> UNDERWATER water_level..water_level+tidal_height -> TIDAL tidal_top..max_beach_height -> BEACH above max_beach_height -> UPLAND (no override) - 4 beach types (SANDY / TIDAL_FLAT / PEBBLE / ROCKY) producing different material per zone (sand vs gravel vs rock) - Optional height-smoothing pulls upland gradually toward water level inside the beach zone, so the transition isn't a cliff Abstract material codes (NOT game block IDs) -- caller maps to their voxel palette. Keeps this primitive substrate-pure so it composes with non-voxel applications too (scientific terrain visualisers, map renderers, etc.). V2 follow-ups (queued): - Dune barriers behind the beach zone (composes a wind-direction hint with nx_wind_erosion v2) - Per-tide-cycle wet/dry striping in the TIDAL band - Beach width modulation by slope (gentle slope -> wide beach; steep slope -> narrow / pocket beach) - River-mouth detection (beach widens at delta junctions; reads nx_river_carve segment ends) - Cliff-face emergence (ROCKY beach + steep slope -> exposed bedrock cliffs instead of beach) Loss audit: Q14 integer arithmetic; ramp interpolation is exact in the documented bands. Classification is sealed-enum so no "interpolated zone" half-state. genealogy_id: bascom_1980_waves_beaches +

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_beach_zone.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_beach_zone_classify nx_beach_zone_is_valid nx_beach_type_is_valid nx_beach_material_is_valid nx_beach_material nx_beach_height_smooth nx_beach_zone_classify ↻

structs

none

consts

62const NX_BEACH_Q: nx_int = 16384
66const NX_BEACH_ZONE_UNDERWATER: nx_int = 0 // below water_level
67const NX_BEACH_ZONE_TIDAL: nx_int = 1 // wave-washed wet zone
68const NX_BEACH_ZONE_BEACH: nx_int = 2 // dry-sand zone above tidal
69const NX_BEACH_ZONE_UPLAND: nx_int = 3 // beyond max_beach_height, no override
71const NX_BEACH_ZONE_COUNT: nx_int = 4
75const NX_BEACH_TYPE_SANDY: nx_int = 0 // soft sand, classic shoreline
76const NX_BEACH_TYPE_TIDAL_FLAT: nx_int = 1 // wide gentle, mud / wet sand
77const NX_BEACH_TYPE_PEBBLE: nx_int = 2 // shingle / pebble
78const NX_BEACH_TYPE_ROCKY: nx_int = 3 // rocky shoreline, exposed rock
80const NX_BEACH_TYPE_COUNT: nx_int = 4
90const NX_BEACH_MATERIAL_PASSTHROUGH: nx_int = 0
91const NX_BEACH_MATERIAL_WATER: nx_int = 1
92const NX_BEACH_MATERIAL_SAND: nx_int = 2
93const NX_BEACH_MATERIAL_GRAVEL: nx_int = 3
94const NX_BEACH_MATERIAL_ROCK: nx_int = 4
96const NX_BEACH_MATERIAL_COUNT: nx_int = 5

functions

99func nx_beach_zone_is_valid(z: nx_int) -> nx_int
called by 1: main
107func nx_beach_type_is_valid(t: nx_int) -> nx_int
called by 1: main
115func nx_beach_material_is_valid(m: nx_int) -> nx_int
called by 1: main
138func nx_beach_zone_classify(
163func nx_beach_material(zone: nx_int, beach_type: nx_int) -> nx_int
called by 1: main
194func nx_beach_height_smooth(
called by 1: main calls 1: nx_beach_zone_classify
232func main() -> i64