Builds the ocean's geometry clipmap: concentric rings, the stitch that
ties them together, and the skirt that carries the water to the horizon.
extent(levels: number, baseTile: number) → number
Extent of a clipmap with these settings, in metres.
| arg | type | description |
|---|
| levels | number | Ring count. |
| baseTile | number | Level-0 tile side, metres. |
examples
local extent = Clipmap.extent(5, 800)
levelSize(baseTile: number, l: number) → number
| arg | type | description |
|---|
| baseTile | number | |
| l | number | |
levelCell(baseTile: number, segments: number, l: number) → number
| arg | type | description |
|---|
| baseTile | number | |
| segments | number | |
| l | number | |
begin(self: ?, places: number?) → void
| arg | type | description |
|---|
| self | ? | |
| places | number? | |
vertex(self: ?, x: number, z: number) → number
The weld map keys on the QUANTIZED NUMBERS themselves, one table level per
axis. A vertex is welded millions of times across the rings, and hashing
two numbers is what keeps the whole build inside a frame's budget where
formatting a string key put it seconds over, and unlike packing the pair
into one number, nested keys stay exact however far a skirt reaches.
| arg | type | description |
|---|
| self | ? | |
| x | number | |
| z | number | |
tri(self: ?, a: number, b: number, c: number) → void
| arg | type | description |
|---|
| self | ? | |
| a | number | |
| b | number | |
| c | number | |
plane(b: any, size: number, segments: number) → void
Level 0: a plain subdivided square, `size` across, `segments` cells per side.
| arg | type | description |
|---|
| b | any | |
| size | number | |
| segments | number | |
ring(b: any, inner: number, outer: number, cell: number) → void
One ring: a uniform grid minus the inner square, and minus the single band of
cells adjacent to it. The stitch covers that band.
| arg | type | description |
|---|
| b | any | |
| inner | number | |
| outer | number | |
| cell | number | |
stitch(b: any, baseTile: number, segments: number, l: number) → void
The fine-to-coarse stitch between level `l` and level `l + 1`.
Each fine sample along the shared edge is paired with the coarse vertex it
snaps to. Where two consecutive fine samples snap to the SAME coarse vertex
the quad degenerates, and a single triangle is emitted instead, that is the
fan that removes the T-junction.
| arg | type | description |
|---|
| b | any | |
| baseTile | number | |
| segments | number | |
| l | number | |
skirt(b: any, inner: number, outer: number, cell: number) → void
The horizon skirt, fanned out from the outermost ring to `outer`.
It is welded at a coarser tolerance than the ring and the stitch: its
coordinates are scaled by `outer / inner`, which makes them the least exact of
the three.
| arg | type | description |
|---|
| b | any | |
| inner | number | |
| outer | number | |
| cell | number | |
side(edgeIn: number, edgeOut: number, horizontal: boolean, flip: boolean) → void
| arg | type | description |
|---|
| edgeIn | number | |
| edgeOut | number | |
| horizontal | boolean | |
| flip | boolean | |
build(options: { [string]: any }) → Geometry
Build a clipmap.
side, ring count, the level-0 tile in metres, and how far the horizon skirt
reaches. The skirt is skipped when it would fall inside the outermost ring.
vertex and index buffers.
skirtDistance = 0.95 * camera.far })
| arg | type | description |
|---|
| options | { [string]: any } | `{ segments, levels, baseTile, skirtDistance }`: cells per ring |
examples
local geo = Clipmap.build({ segments = 64, levels = 5, baseTile = 800,