Terrain · function
encodeTerrainSplat
Encode four material weights per sample.
Explained in Terrain.
function encodeTerrainSplat(width: number, depth: number, weights: ArrayLike<number>): TerrainSplatLayerimport { encodeTerrainSplat } from '@driftengine/terrain';Parameters
| Parameter | Type | Description |
|---|---|---|
width | number | |
depth | number | |
weights | ArrayLike<number> |
In depth
Refuses a map whose weights do not already sum to one, rather than normalising it on the way in. A weight map nobody filled in sums to zero at every texel, and a normalisation applied quietly turns that into "material zero, everywhere" — a whole world of one texture, shipped, with no error anywhere. The caller's own weights are a statement about the ground and this does not edit it.