Expand description
The async GDScript bake contract (CEL-86): pure helpers + the submission
queue a crate::builder::CesBuilder hands results back through.
A GDScript builder that defines _bake_requested(requests) is baked
ASYNCHRONOUSLY: the planet hands it a batch of chunks each frame and the
builder submits surfaces back — from any thread, at any time, any number of
times per chunk — via submit_chunk. Submissions land in SubmitQueue,
which the planet drains on the main thread into the SAME ready_surfaces
map the Rust crate::bake_pool::BakePool fills. Admission gating, coarse
ancestor stand-ins and per-frame throttling therefore apply unchanged — they
never knew where a surface came from.
Re-submitting an already-resident chunk marks it dirty and re-realizes it, which is exactly the streaming refinement path (a coarse tile now, a finer one when the download lands) with no extra API.
Everything here is pure and unit-tested; the Godot glue lives in
builder.rs (the #[func]s) and celestial.rs (drain / request /
gate).
Structs§
- RawSubmission
- A raw
submit_chunkpayload as GDScript handed it over. Held as plainVecs (notPackedArrays, which are notSend) so the queue can cross threads. Validated at drain time, wheretile_resis known. - Submission
- A validated surface.
normal == None⇒ finite-difference it (the planet has the chunk geometry; the builder may not). - Submit
Queue - The mutex-guarded hand-back channel owned by a
CesBuilder.
Enums§
- Submit
Error - Why a
submit_chunkpayload was rejected.
Constants§
- MAX_
HANDLE_ DEPTH - Deepest chunk depth a handle can encode.
ChunkId::pathspends 2 bits per level, sodepth <= 20fits the 40 path bits below. - TAG_
BITS - Per-planet tag, so two planets sharing one builder
.trescannot have their submissions cross-wired: a planet ignores any handle not bearing its tag. - TAG_
MASK - Mask a raw planet tag down to the bits a handle can carry.
Functions§
- chunk_
dirs - The texel-centre world directions of a chunk, row-major,
tile_res²of them. - fd_
normals pack_normalswith no builder-supplied normals: pure finite difference.- handle_
decode - Unpack a handle, rejecting anything not stamped with
tag(a submission meant for a different planet) and anything negative or over-wide. - handle_
encode - Pack
(tag, id)into the opaquei64handle GDScript sees. ReturnsNonefor a chunk too deep to encode (depth > MAX_HANDLE_DEPTH) — such a chunk is simply never handed to an async builder. - pack_
normals - Pack a chunk’s rgba8 world normals: each texel uses
over[i]when the builder supplied one, else a curvature-correct finite difference of the height grid — the same constructionNoiseProvideruses (the chunk’s edge vectors are projected perpendicular to the radial direction before the height gradient is added along it). - validate_
submission - Validate and convert a raw
submit_chunkpayload.