Skip to content

@relu-interactives/spatial-ecs


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

Function: buildChunkGeometry() ​

ts
function buildChunkGeometry(
   field, 
   layers, 
   chunkQuads, 
   cx, 
   cz, 
   level, 
   skirt): BufferGeometry;

Defined in: terrain/terrainMesh.ts:42

Build one chunk's geometry at a level of detail (stride = 2^level grid steps between vertices). Positions are terrain-space; normals come from the heightfield, so chunks at different levels meet with the same shading. A skirt hangs down skirt metres around the edge to hide the cracks where a detailed chunk meets a simpler one. Colours blend the paint layers.

Parameters ​

ParameterType
fieldHeightfield
layersreadonly TerrainLayer[]
chunkQuadsnumber
cxnumber
cznumber
levelnumber
skirtnumber

Returns ​

BufferGeometry