benilla-re systems structs docs

CMapChunk::GetHeight

function · terrain · primitive

Address
0x6b72a0 · 607 bytes, up to 0x6b74fe
Signature
int32_t __fastcall (CMapChunk *chunk, const float *point, int32_t column, int32_t row, float *out)
Meaning
Writes the height of the cell triangle under a point, normalising with rsqrtss when SSE is present
Confidence
verified, proof one
Finding
terrain/queries#chunk-height
Test
terrain::chunk_get_height, terrain::chunk_get_height_quadrants

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.

Callers 1

Callees 5

Calls and jumps by a bare address, from tables/calls.tsv.