Builtin Library
README.md
pathNetwork.ground
The ground a path network stands on: the Terrain entities under it, the
height the ground had before any path changed it, and the conforming of the
ground to the paths. Each footprint (an edge's cross-sections, or a
junction's disc) holds the ground level with its surface out to the shoulder,
then blends it back over the falloff band. The ground between texels is flat
triangles, each a blend of its three corner texels, so wherever a ground
triangle would stand less than bed under a flat triangle of a surface over
it (along the low edge of a banked road, in a sag, where a road twists onto
a junction) its corners are lowered until it stands bed under. The corners
under the surface go first, where the surface hides them, each no deeper
than shows beside the surface by more than the triangle stood over it; the
corners beside the surface carry what is left. The ground stays under the
surface at any bank, grade or twist, and level with the surface along its
edges. At a corner of a surface's outline (the low corner of a banked
road's end) a ground cell spans both sides of the corner, and the ground
beside the corner dips under the surface's edge there. A texel is
judged against every footprint near it, so where paths overlap the one
holding it most strongly wins, and a texel no path holds any more is given
back its own height. Writes
go through Terrain:setHeights, which rebuilds the drawn ground and the
collision tiles the change reaches.
| Function | |
|---|---|
open(terrains) | The ground state for the named terrains (or every Terrain in the scene). |
present(state) | Whether any terrain has loaded. |
stale(state) / settle(state) | Whether a terrain holds ground the network has not conformed (loaded since, or read again from its asset), and recording the ground as conformed. |
baseHeight(state, x, z) / height(state, x, z) | The ground before the network changed it, and as it stands now. |
edgeFootprint(sections, opts) / discFootprint(cx, cz, radius, y, ring, opts) | Footprints: an edge's cross-sections, or a junction's fan. |
conform(state, changed, all) | Conform the area the changed footprints reach. |
restore(state) | Give back every height the network changed. |