fineTerrainFrom()
Rebuild a fine terrain from fineTerrainInit data, on a worker or anywhere: the coarse terrain from its heights (nothing is resampled) and the refinement over it. Cheap (the cost is one pass over the heights for maxY); every brick then fills byte-identically to the original.
function fineTerrainFrom(init: FineTerrainInit): FineTerrain;Defined in: init.ts:59
Parameters
| Parameter | Type | Description |
|---|---|---|
init | FineTerrainInit | The description, as received. |
Returns
The fine terrain; its fillBrick applies init.options.top when a call passes none.
Example
// worker
let fill: (cells: Uint8Array, ox: number, oy: number, oz: number) => boolean;
onmessage = ({ data }) => {
const fine = fineTerrainFrom(data.fine);
fill = (cells, ox, oy, oz) => fine.fillBrick(cells, ox, oy, oz, data.base);
};completeTerrainParams()
Params with every default filled in, exactly as generateTerrain merges them: fields from DEFAULTTERRAIN under params, and river merged field by field. Idempotent, and always returns a fresh object (the river too), so the result can be edited or posted.
fineTerrainInit()
Describe a fine terrain as data for a worker. top (default: the fine terrain's options.top) is evaluated on every coarse column once, so a closure over app state (a settlement's paths and yards) becomes a Uint8Array. Heights are copied as they are now: level before calling.