benilla-re systems structs docs

BuildLookAtMatrix

function · gxumath · primitive

Address
0x5c3e70 · 648 bytes, up to 0x5c40f7
Signature
void __fastcall (const float *eye, const float *target, const float *up, float *out)
Meaning
Writes the view matrix of an eye, a target and an up vector; error 0x57 for a short view or up vector
Confidence
verified, proof one
Finding
gxumath#look-at-matrices
Test
gxumath::lookat_v1_difftest

Finding: Look-at matrices in gxumath

0x5c3e70 (ecx the eye, edx the target; the up vector and the output on the stack; ret 8) writes a view matrix. With f = normalize(target − eye), s = normalize(f × up) and u = s × f: m0 m4 m8 is s, m1 m5 m9 is u, m2 m6 m10 is f, m3 m7 m11 are 0 and m15 is 1. m12 m13 m14 is the eye negated through 0x7bdc40; m12 = (−e.z·m8 + −e.y·m4 + −e.x·m0) + 0. It fails when |target − eye|² or |up|² is under 0.01. 0x5c4100, which no code calls, uses s' = up × f and u' = f × s', which negates m0 m4 m8 and m12.

The derivation is in the doc.

Callers 6

Callees 3

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