Expand description
Neutral CPU-baked surface type + the provider trait that supplies it.
The chunked planet bakes each chunk’s surface into three per-slot GPU
buffers — colour (rgba8), height (f32, in the provider’s own vertical unit)
and normal (rgba8-packed) — and the realize/bake shaders read them when the
surface is enabled. TWO paths fill those buffers:
- GPU procedural noise — a compute shader computes them in place (the
default; no provider,
surface_enabled == 0). - CPU async — a worker pool (
crate::bake_pool::BakePool) calls aCpuSurfaceProvideroff the main thread to produce aChunkSurface, which the planet uploads into buffers 4/5/6 and the shaders read when the surface is enabled. The built-in provider iscrate::noise_provider(CPU fBm terrain), used by acrate::builder::CesBuilderon thecrate::builder::BuilderRoute::CpuNoiseroute.
This module holds ONLY the neutral data type and the trait — no concrete surface source, no Godot rendering.
Structs§
- Chunk
Surface - A resampled per-chunk surface:
coloristile_res·tile_res·4RGBA8,heightistile_res·tile_reselevations (the provider’s vertical unit, scaled byCpuSurfaceProvider::height_scaleon the GPU), andnormalistile_res·tile_res·4rgba8-packed world normals — all row-major. The chunk’s real footprint is the lower-left triangle, but the WHOLE square holds valid data (texels past the diagonal replicate the nearest diagonal sample; see [crate::surface_tiles::build_patch]).
Traits§
- CpuSurface
Provider - A source of CPU-baked chunk surfaces (colour/height/normal). Implementors run
on the bake worker pool (
bakeis called off the main thread, so it must beSend + Syncand use interior mutability for any shared state). The other hooks run on the main thread.