Skip to content

PlanetProvider

Defined in: sdk/src/terrain/planetProvider.ts:35

A generator of ground on a sphere.

readonly optional fields?: readonly string[]

Defined in: sdk/src/terrain/planetProvider.ts:46

The names of fields the ground has beyond its height and paint, which a generated world reads as part of its environment (an ecology: how much of a place is a wetland). A game’s own generator decides them, so the ground that is drawn and what grows on it come from one function.


readonly id: string

Defined in: sdk/src/terrain/planetProvider.ts:37

The name a Planet asks for it by.


readonly versions: readonly number[]

Defined in: sdk/src/terrain/planetProvider.ts:39

The generator versions it can still make.


readonly optional workerSource?: string

Defined in: sdk/src/terrain/planetProvider.ts:51

The text of a self-contained module (plain JavaScript, no imports) whose default export is this provider’s id, versions, fields and sample, so that a worker can load the generator and a generated world can be laid out off the main thread. Absent, the world is laid out on the main thread.

range(seed, version, radius): [number, number]

Defined in: sdk/src/terrain/planetProvider.ts:41

The least and most height above the radius its ground can have for this seed, version and radius: what the GPU encodes heights over.

number

number

number

[number, number]


sample(region): PlanetSamples | Promise<PlanetSamples>

Defined in: sdk/src/terrain/planetProvider.ts:53

The ground in the directions asked: heights in metres above the radius, the layer weights if it paints, and its fields if it has any. May answer later.

PlanetRegion

PlanetSamples | Promise<PlanetSamples>