VoxelTerrainView
The march of a voxel (heightmap) terrain, with no drawing: for each screen column, a ray steps front to back over the map, and wherever the terrain rises above what the column already shows it adds a span. Spans in a column never overlap, run upward from the view's bottom with increasing depth, and same-coloured neighbours merge.
Steps double every bandSteps steps; each band samples the mip level whose cells are about as far apart as its samples (the coarser of the gap between columns and the step), which keeps far terrain from flickering. Map positions are 16.16 fixed point. See specs/2026-11-21-voxel-terrain-spike.md.
Properties
columns(integer) — Columns across the viewbandSteps(integer) — Steps in each depth bandfogColor(integer) — RGB colour far terrain blends towards (-1 for none), from fogStart (a fraction of thefogStart(float)columnSpans(dynamic) — Per column, its spans from the last march: top, height, RGBA colour and the depth (worldcolumnTops(dynamic) — Per column, each place its top rose: depth (world units) then the new top, repeated, incolumnWidth(float) — Width of each column in pixelsviewHeight(float) — Height of the level view last marchedspanCount(integer) — Spans and depth steps in the last marchstepCount(integer)
Constructor
new VoxelTerrainView(map: BGE.VoxelMap): VoxelTerrainViewParameters
map(BGE.VoxelMap)
Instance Methods
getMap(): BGE.VoxelMap
The map being marched.
Returns
setMap(map: BGE.VoxelMap): void
Swaps the map; the next march rebuilds everything that depends on it.
Parameters
map(BGE.VoxelMap)
Returns
void
occluderTopAt(column: integer, depth: float): float
The top of the last span in a column that starts nearer than depth: everything in the column from there down hides what's at that depth. The view's height if none does.
Parameters
column(integer)depth(float) — world units along the view direction
Returns
float
march(pose: BGE.VoxelTerrainPose): void
Marches every column for a pose, replacing columnSpans.
Parameters
pose(BGE.VoxelTerrainPose)
Returns
void
getBandLevels(): Array.<integer>
The band levels of the last march, for tests and the demo's readout.
Returns
Array.<integer>