benilla-re systems structs docs

s_holeBit

global · terrain

Address
0x8103f8 · 64 bytes, up to 0x810437
Type
uint32_t[16]
Meaning
Holds 1 << k for k from 0 to 15, the hole bits of a chunk's 4x4 quads
Confidence
verified, proof one
Finding
terrain/queries#chunk-height

Finding: Chunk height in terrain: queries

0x6b72a0(cell column, cell row, out), on a chunk with the point in edx, returns 0 in a hole and otherwise writes the height of the triangle of the cell under the point and returns 1. Each cell is four triangles around its inner vertex C, chosen by two signed tests against the cell's diagonals; the height solves the triangle's plane n·q + d = 0 for z at the point's (x, y) and adds the chunk's z. With SSE, which the client detects at start-up, n is normalised with rsqrtss; without it, with an exact square root.

teststriangle
neitherC, V+17, V
firstC, V, V+1
secondC, V+18, V+17
bothC, V+1, V+18

The derivation is in the doc.