benilla-re systems structs docs

NormalizeVector3

function · terrain · primitive

Address
0x6720f0 · 59 bytes, up to 0x67212a
Signature
void __thiscall (void *this)
Meaning
Scales a vector in place by the reciprocal of its length
Confidence
verified, proof one
Finding
terrain/queries#chunk-height
Test
terrain::vec3_normalize_world, terrain::liquid_hit_flush_difftest

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 6

Callees 0

None by a direct call or jump.

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