Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / placeInChunk

Function: placeInChunk() ​

ts
function placeInChunk(
   field, 
   mask, 
   chunk, 
   perSquareMetre, 
   seed, 
   spacing?): Placement[];

Defined in: terrain/FoliageSystem.ts:62

Where things go in one chunk (terrain space, metres): perSquareMetre tries per square metre, kept where the mask allows and at least spacing from the others. Deterministic, and in random order, so drawing the first N of them thins the chunk evenly.

Parameters ​

ParameterTypeDefault value
fieldHeightfieldundefined
maskFoliageMaskundefined
chunk{ x0: number; z0: number; size: number; }undefined
chunk.x0numberundefined
chunk.z0numberundefined
chunk.sizenumberundefined
perSquareMetrenumberundefined
seednumberundefined
spacingnumber0

Returns ​

Placement[]