benilla-re systems structs docs

DistanceSquared

function · terrain · primitive

Address
0x69be70 · 46 bytes, up to 0x69be9d
Signature
float __thiscall (void *this, uint32_t arg2)
Meaning
Returns the squared distance of two points, (dx² + dz²) + dy² at 53 bits
Confidence
verified, proof one
Finding
terrain/queries#liquid-height
Test
terrain::vec3_dist2_difftest

Finding: Liquid height in terrain: queries

0x6b7500(u, v, out), on a chunk with the point in edx, takes u = (17066.666 − y)·0.24, v from x. With i = round(u − 0.5), j = round(v − 0.5), fu = u − i and fv = v − j, stored, it takes the first slot whose tile (j & 7, i & 7) is typed, else returns 0. Ocean (type & 3 ==

  1. is height 0; otherwise, h01 being the next column's MCLQ height and h10 the next row's, a = (h01 − h00)·fu + h00, b = (h11 − h10)·fu + h10 and h = (b − a)·fv + a, at 53 bits, stored once. The masks wrap any u and v into the chunk.

The derivation is in the doc.

Callers 2

Callees 0

None by a direct call or jump.

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