Skip to content

@bendyline/molen-worldgen-earth/client ​

Earth binding for Molen worldgen: terrain-semantics adapter, OSM label mapping, and lon/lat region atlas (kernel) with terrain tile renderers (client).

ts
import { /* … */ } from '@bendyline/molen-worldgen-earth/client';

Interfaces ​

InThreadGeneratorOptions ​

Properties ​

atlas? ​
ts
optional atlas?: RegionAtlasDoc;
places? ​
ts
optional places?: PlacesContent;

Landmarks and business identities for mapped places (none when omitted).

regions? ​
ts
optional regions?: RegionResolver;
yieldEveryBuildings? ​
ts
optional yieldEveryBuildings?: number;

Buildings generated between cooperative yields (default 48).


LoadRegionAtlasOptions ​

Properties ​

fetch? ​
ts
optional fetch?: (input, init?) => Promise<Response>;

MDN Reference

Parameters ​
input ​

RequestInfo | URL

init? ​

RequestInit

Returns ​

Promise&lt;Response&gt;

signal? ​
ts
optional signal?: AbortSignal;

WorkerLike ​

Methods ​

addEventListener() ​
ts
addEventListener(type, listener): void;
Parameters ​
type ​

"message"

listener ​

(event) => void

Returns ​

void

postMessage() ​
ts
postMessage(message, transfer?): void;
Parameters ​
message ​

unknown

transfer? ​

Transferable[]

Returns ​

void

removeEventListener()? ​
ts
optional removeEventListener(type, listener): void;
Parameters ​
type ​

"message"

listener ​

(event) => void

Returns ​

void

terminate()? ​
ts
optional terminate(): void;
Returns ​

void


WorldgenGenerateRequest ​

Properties ​

budgets? ​
ts
optional budgets?: Partial<WorldgenBudgets>;
features? ​
ts
optional features?: object;
buildings? ​
ts
optional buildings?: boolean;
interiors? ​
ts
optional interiors?: boolean;
scatter? ​
ts
optional scatter?: boolean;
geom ​
ts
geom: TileGeometry;
ground ​
ts
ground: HeightSampler;

World-space ground of the tile (a terrain heightfield).

renderCellsOnly? ​
ts
optional renderCellsOnly?: boolean;

Renderer requests compact cells instead of retaining a second canonical vertex copy.

resolution ​
ts
resolution: number;

Samples per tile edge for the transferable height grid (the terrain tile resolution).

tierOffset? ​
ts
optional tierOffset?: number;
tile ​
ts
tile: TerrainSemanticTile;

WorldgenGenerator ​

Produces tile output somewhere: in a worker, in-thread, or from a cache in front of either.

Methods ​

dispose() ​
ts
dispose(): void;
Returns ​

void

generate() ​
ts
generate(request, signal): Promise<WorldgenTileOutput | undefined>;
Parameters ​
request ​

WorldgenGenerateRequest

signal ​

AbortSignal

Returns ​

Promise&lt;WorldgenTileOutput | undefined&gt;


WorldgenRendererOptions ​

Properties ​

atlas? ​
ts
optional atlas?: RegionAtlasDoc;
budgets? ​
ts
optional budgets?: Partial<WorldgenBudgets>;
cache? ​
ts
optional cache?: WorldgenTileCache;

CPU-side cache of generated tiles keyed by pack, atlas, quality, and address.

generator? ​
ts
optional generator?: WorldgenGenerator;

Where tiles are generated (default: on this thread); e.g. createWorldgenWorkerBridge.

interiors? ​
ts
optional interiors?: boolean | Omit<InteriorStreamingOptions, "catalog">;

Real openings and bounded lazy interiors, including residential upstairs (opt in). They are laid out by the style pack's interior catalog; a pack without one generates no interiors.

landcover? ​
ts
optional landcover?: TerrainSemanticMeshOptions;

Options forwarded to the default land surface (colors default to the scatter surface colors).

landcoverGenerator? ​
ts
optional landcoverGenerator?: TerrainLandcoverGenerator;

Optional worker-backed land-cover surface draping. Caller owns its lifetime.

lodPolicy? ​
ts
optional lodPolicy?: ScreenSpaceLodPolicy;

Shared screen-space policy for resident building and vegetation LODs.

materials? ​
ts
optional materials?: WorldgenMaterialSet;
metersPerUnit? ​
ts
optional metersPerUnit?: number;

cos(center latitude) factor of the terrain package (1 for local packages).

models? ​
ts
optional models?: ModelLibrary;

Prepared prop models; without it the classification layer keeps the default tree cones.

onTileStats? ​
ts
optional onTileStats?: (output, generateMs) => void;
Parameters ​
output ​

WorldgenTileOutput

generateMs ​

number

Returns ​

void

places? ​
ts
optional places?: PlacesContent;

Landmarks and business identities for mapped places; without them businesses are not recognized and street furniture is not placed. With a worker generator, pass the worker the same content; tile cache keys include its hashes.

prepareObject? ​
ts
optional prepareObject?: (object, signal, parent?) => Promise<void>;

Prepare replacement architecture before a resident quality change becomes visible. parent is the layer object the replacement will join.

Parameters ​
object ​

Object3D

signal ​

AbortSignal

parent? ​

Object3D&lt;Object3DEventMap&gt;

Returns ​

Promise&lt;void&gt;

propLod? ​
ts
optional propLod?: boolean;

Camera-distance vegetation LOD and spatial culling (default true).

quality? ​
ts
optional quality?: WorldgenQualityPreset;
regions? ​
ts
optional regions?: RegionResolver;
roads? ​
ts
optional roads?: TerrainSemanticMeshOptions;

Shared surface styles/controller for roads, parking areas, markings and fixtures.

sampleStructureTerrain? ​
ts
optional sampleStructureTerrain?: StructureTerrainSampler;

Fine or cross-tile ground samples; undefined coverage leaves the procedural fallback.

structureModels? ​
ts
optional structureModels?: ModelLibrary;

Streamed geographic models; defaults to models when no separate library is supplied.

structureObjects? ​
ts
optional structureObjects?: StructureModelLibrary;

Full glTF hierarchy and PBR materials for authored structures; preferred over flattened props.

structures? ​
ts
optional structures?: StructureIndex;

Authored geographic structures, indexed by geohash for tile lookup.

viewingDate? ​
ts
optional viewingDate?: string;

Explicit YYYY-MM-DD date for archival landmarks; omitted keeps them unloaded.

yieldEveryBuildings? ​
ts
optional yieldEveryBuildings?: number;

Buildings generated between cooperative yields (default 48, in-thread only).


WorldgenRenderStats ​

Properties ​

boxes ​
ts
boxes: number;
buildings ​
ts
buildings: number;
cache? ​
ts
optional cache?: object;
bytes ​
ts
bytes: number;
hits ​
ts
hits: number;
misses ​
ts
misses: number;
size ​
ts
size: number;
generateMs ​
ts
generateMs: object;
last ​
ts
last: number;
max ​
ts
max: number;
mean ​
ts
mean: number;
geometryBytes ​
ts
geometryBytes: number;
interiors? ​
ts
optional interiors?: InteriorStreamingStats;
props ​
ts
props: number;
skippedByOwnership ​
ts
skippedByOwnership: number;
tiles ​
ts
tiles: number;

WorldgenSemanticRenderers ​

Properties ​

classification ​
ts
classification: TerrainSemanticTileRenderer;
humanFeatures ​
ts
humanFeatures: TerrainSemanticTileRenderer;

Methods ​

dispose() ​
ts
dispose(): void;
Returns ​

void

setCacheBudget() ​
ts
setCacheBudget(maxBytes): void;
Parameters ​
maxBytes ​

number

Returns ​

void

setQuality() ​
ts
setQuality(quality): void;

Rebuild resident architecture cooperatively, keeping the previous geometry until ready.

Parameters ​
quality ​

WorldgenQualityPreset

Returns ​

void

stats() ​
ts
stats(): WorldgenRenderStats;
Returns ​

WorldgenRenderStats

updateInteriors() ​
ts
updateInteriors(position): void;

Call before walking collision with the camera in metric world coordinates.

Parameters ​
position ​

readonly [number, number, number]

Returns ​

void


WorldgenTileCache ​

Properties ​

bytes ​
ts
readonly bytes: number;
evictions ​
ts
readonly evictions: number;
hits ​
ts
readonly hits: number;
misses ​
ts
readonly misses: number;
size ​
ts
readonly size: number;

Methods ​

clear() ​
ts
clear(): void;
Returns ​

void

delete() ​
ts
delete(key): boolean;
Parameters ​
key ​

string

Returns ​

boolean

get() ​
ts
get(key): WorldgenTileOutput | undefined;
Parameters ​
key ​

string

Returns ​

WorldgenTileOutput | undefined

set() ​
ts
set(key, output): void;
Parameters ​
key ​

string

output ​

WorldgenTileOutput

Returns ​

void

setLimits() ​
ts
setLimits(options): void;

Trim immediately when the device working-set budget changes.

Parameters ​
options ​

WorldgenTileCacheOptions

Returns ​

void


WorldgenTileCacheKeyParts ​

Properties ​

atlasHash? ​
ts
optional atlasHash?: string;
features ​
ts
features: object;
buildings ​
ts
buildings: boolean;
scatter ​
ts
scatter: boolean;
level ​
ts
level: number;
packHash ​
ts
packHash: string;
quality ​
ts
quality: string;
variant? ​
ts
optional variant?: string;

Effective generation settings, when they differ within one named quality preset.

x ​
ts
x: number;
z ​
ts
z: number;

WorldgenTileCacheOptions ​

Properties ​

maxBytes? ​
ts
optional maxBytes?: number;

Bytes of mesh and instance data kept (default 256 MiB).

maxEntries? ​
ts
optional maxEntries?: number;

Entries kept (default 256).


WorldgenWorkerBridgeOptions ​

Properties ​

atlas? ​
ts
optional atlas?: RegionAtlasDoc;
metersPerUnit ​
ts
metersPerUnit: number;
ownsWorker? ​
ts
optional ownsWorker?: boolean;

Terminate the worker on dispose (default true).

pack ​
ts
pack: ResolvedStylePack;
places? ​
ts
optional places?: PlacesContentDocs;

Places content documents to generate with (none when omitted). Give the renderer the same content as places so its tile cache keys match what the worker generates.

Type Aliases ​

StructureTerrainSampler ​

ts
type StructureTerrainSampler = (coordinate, request) => number | undefined | Promise<number | undefined>;

Heights use the same metres and vertical reference as the host's terrain geometry.

Parameters ​

coordinate ​

readonly [number, number]

request ​

Readonly&lt;{ entry: StructurePlacement; signal: AbortSignal; }&gt;

Returns ​

number | undefined | Promise&lt;number | undefined&gt;

Functions ​

createInThreadWorldgenGenerator() ​

ts
function createInThreadWorldgenGenerator(pack, options?): WorldgenGenerator;

Generate on the calling thread, yielding to the host between chunks and honouring aborts.

Parameters ​

pack ​

ResolvedStylePack

options? ​

InThreadGeneratorOptions

Returns ​

WorldgenGenerator


createWorldgenSemanticRenderers() ​

ts
function createWorldgenSemanticRenderers(pack, options?): WorldgenSemanticRenderers;

Renderers for the classification and human-feature layers of a terrain package.

Parameters ​

pack ​

ResolvedStylePack

options? ​

WorldgenRendererOptions

Returns ​

WorldgenSemanticRenderers


createWorldgenTileCache() ​

ts
function createWorldgenTileCache(options?): WorldgenTileCache;

Parameters ​

options? ​

WorldgenTileCacheOptions

Returns ​

WorldgenTileCache


createWorldgenWorkerBridge() ​

ts
function createWorldgenWorkerBridge(worker, options): WorldgenGenerator;

Parameters ​

worker ​

WorkerLike

options ​

WorldgenWorkerBridgeOptions

Returns ​

WorldgenGenerator


loadRegionAtlas() ​

ts
function loadRegionAtlas(url, options?): Promise<RegionAtlasDoc>;

Parameters ​

url ​

string | URL

options? ​

LoadRegionAtlasOptions

Returns ​

Promise&lt;RegionAtlasDoc&gt;


outputBytes() ​

ts
function outputBytes(output): number;

Parameters ​

output ​

WorldgenTileOutput

Returns ​

number


tileHeightGrid() ​

ts
function tileHeightGrid(
   ground, 
   geom, 
   resolution
): HeightGrid;

Sample a tile's ground into the grid both generation paths use.

Parameters ​

ground ​

HeightSampler

geom ​

TileGeometry

resolution ​

number

Returns ​

HeightGrid


withWorldgenTileCache() ​

ts
function withWorldgenTileCache(
   generator, 
   cache, 
   keyOf
): WorldgenGenerator;

Serve repeat tiles from the cache; generate (and remember) the rest.

Parameters ​

generator ​

WorldgenGenerator

cache ​

WorldgenTileCache

keyOf ​

(request) => string

Returns ​

WorldgenGenerator


worldgenTileCacheKey() ​

ts
function worldgenTileCacheKey(parts): string;

Parameters ​

parts ​

WorldgenTileCacheKeyParts

Returns ​

string

References ​

createRegionResolver ​

Re-exports createRegionResolver


RegionResolver ​

Re-exports RegionResolver


RegionResolverOptions ​

Re-exports RegionResolverOptions

37 guides · 36 schema formats · 41 API entry points · 10 samples. API, CLI and schema pages are generated from the shipped build.