Large worlds · function
cellsInFrustum
Every cell the view looks into, into out, in coordinate order. Returns how many.
Explained in Coordinates and units.
function cellsInFrustum(grid: CellGrid, viewProj: ArrayLike<number>, out: number[]): numberimport { cellsInFrustum } from '@driftengine/core';Parameters
| Parameter | Type | Description |
|---|---|---|
grid | CellGrid | |
viewProj | ArrayLike<number> | |
out | number[] |
In depth
viewProj is column-major and OpenGL-convention, as gl-matrix builds one, and in absolute
world units — in double precision if the world is past 2^24, because a plane's offset out there
is not a number a single float holds to the metre.
Conservative, as cellsInRadius is: a cell is left out only when it lies wholly beyond one of
the view's planes, so every point the view can see is in a returned cell, and a cell near a
corner of the view can be returned without being seen. The cells walked are those inside the
box round the view's eight corners, which is why a view with no far plane is refused: its box has
no far side.