voxolith
API reference@voxolith/gen-terrainFunctions

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

ParameterTypeDescription
initFineTerrainInitThe description, as received.

Returns

FineTerrain

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);
};

On this page