benilla-re systems structs docs

ProjectPointsToWindow

function · gxumath · primitive

Address
0x5c4f30 · 701 bytes, up to 0x5c51ec
Signature
uint32_t __fastcall (uint32_t count, const float *in, float *out)
Meaning
Maps world points to window coordinates through the device matrices; returns 0 where clip w is near 0
Confidence
verified, proof one
Finding
gxumath#world-points-to-the-screen
Test
gxumath::unproject_difftest

Finding: World points to the screen in gxumath

0x5c4f30 (ecx a count, edx the points, the output on the stack, ret 4) maps world points to window coordinates and returns 1, or 0 at the first point whose clip |w'| is under 0.001. M is 0x7bc6a0 of the top of the device's matrix stack 8 and the matrix 0x58b0c0 gives; (x', y', z', w') is (x, y, z, 1) through 0x7bcb40; iw = 1/w'; r is the four floats of 0x58a240. Then out.x = (x'·iw + 1)·0.5·(r3 − r1) + r1, out.y = (y'·iw + 1)·0.5·(r2 − r0) + r2 and out.z = ((z'·iw + 1)·0.5·zs − zn) + zn, with zn and zs the last two scalars of 0x58b060. Earlier points keep their values on a failure.

The derivation is in the doc.

Callers 1

Callees 6

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