benilla-re systems structs docs

BuildFrustumCorners

function · gxumath · primitive

Address
0x5c43b0 · 1404 bytes, up to 0x5c492b
Signature
void __fastcall (const NTempest::C44Matrix *view, const NTempest::C44Matrix *proj, float *corners)
Meaning
Writes the eight world-space corners of the frustum of a view and a projection matrix
Confidence
verified, proof one
Finding
gxumath#frustum-corners
Test
gxumath::frustum_corners_difftest

Finding: Frustum corners in gxumath

0x5c43b0 (ecx the view matrix, edx the projection, an array of eight three-vectors on the stack, ret 4) writes the world-space corners of the frustum. With inv(proj)·inv(view) from 0x7bcf90, 0x7bd6c0 and 0x7bc6a0, the clip corners are (sx, sy, ∓1, 1) for a projection whose |m15 − 1| is under the float 2⁻²², and otherwise (sx·n, sy·n, −n, n) near and (sx·f, sy·f, f, f) far, with n = −m14/(m10 + 1) and f = −m14/(m10 − 1). (sx, sy) runs (−,−), (−,+), (+,+), (+,−). Each corner goes through 0x7bcb40 and keeps three components: near corners at offsets 0 to 0x24, far at 0x30 to 0x54.

The derivation is in the doc.

Callers 7

Callees 5

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