Heightfield

interface Heightfield
universe/src/terrain.ts:1017

Members

borderreadonly

border: number

coverreadonly

cover: Uint8Array

What the ground is made of, four bytes a vertex, row-major over the patch.

resolution² samples with no border, unlike elevations: the border rows exist to be differenced against and nothing differences the cover, so generating them would be 12.7% of a band stack spent on samples no attribute carries. Sample (row, col) is at (row · resolution + col) · 4. See cover.ts for what the four are.

elevationsreadonly

elevations: Float32Array

Row-major elevations relative to the body datum, meters.

(resolution + 2 · border)² of them: sample (row, col) of the patch is at (row + border) · stride + (col + border), and negative indices are the border. heightfieldStride and heightfieldSample are the two readers, so that arithmetic is written once.

maxElevationreadonly

maxElevation: number

minElevationreadonly

minElevation: number

Over the patch itself. The border is generated but not summarized.

regionreadonly

resolutionreadonly

resolution: number

Vertices per side of the patch itself, excluding the border.

waterreadonly

water: Float32Array

The level of any water over each vertex, meters relative to the datum, NaN where there is none; resolution² of them, unbordered as the cover is and for the same reason. On a body with a drainage graph it is the whole of the sheet — the sea where the sea reaches, a lake's spill, a river's surface — and the mesh builder is handed no datum beside it; on a body without one the sea is the datum the builder is handed.