HeightfieldSource

interface HeightfieldSource

Something that turns a heightfield request into a heightfield.

The pool is one — poolHeightfieldSource below — and a GPU tile producer is another. Heightfields selects an adapter for each supported request. The response is the same shape either way: the bordered elevations, the cover, the extremes. What differs is where the arithmetic ran and whether it is the canonical field — the pool's is generateHeightfield itself, and a producer's is a port of it held to a stated tolerance.

available is how a producer says it can no longer answer — a kernel that would not build, a device that was lost. It rejects pending requests with HeightfieldUnavailable, which lets Heightfields retry them on the fallback while preserving the caller's cancellation handle. The same rejection with available still true is a refusal of one body: that body's requests go to the fallback and the source keeps every other body's. Ordinary request failures propagate; unsupported shapes never reach the adapter.

submit takes what generateHeightfield takes — the surface, and the request — so a caller hands over the object it holds rather than a flattening of it. That is what lets a producer memoize on the surface's identity, which is the identity surfaceKernel and terrainSketch already key on; the pool is the one source with a wire to cross, and its adapter is where the seed becomes a string.

packages/workers/src/tasks.ts:405

Members

availablereadonly

available: boolean

kindreadonly

kind: string

'pool', 'gpu' — what ir.terrain().producer reports.

maxLevelreadonly

maxLevel?: number

The deepest region level this source produces; a request deeper than it goes to the pool instead. Absent means every level — the pool's own answer, and the default for a source that does not say.

submit

surfaceSurfaceParameters
Undocumented
requestHeightfieldRequest
Undocumented

supports

supports(request: HeightfieldRequest) → boolean

Additional request-shape limits, checked before submitting to this adapter.

requestHeightfieldRequest
Undocumented