benilla-re systems structs docs

BuildDecalTexCoords

function · gxumath · unreached

Address
0x5c5ee0 · 1257 bytes, up to 0x5c63c8
Signature
void __fastcall (const float *points, float *uv, uint32_t resX, uint32_t resY)
Meaning
Replaces four texel coordinate pairs with the decal coordinates of a quadrilateral of world points
Confidence
verified, proof one
Finding
gxumath#decal-texture-coordinates

Finding: Decal texture coordinates in gxumath

0x5c5ee0 (ecx four world points, edx four (u, v) pairs updated in place, resX and resY on the stack, ret 8) replaces the pairs with decal coordinates. It projects the points by 0x5c4d70, rounds them by 0x5c63d0 and lowers a coordinate by 1 when it is above the centroid's. It halves (max u − min u)·(max v − min v)·resX·resY and shifts resX and resY right by the same count until the area is under 3·|cross|, ending if a size reaches 0. A 3×3 fit through three corners then gives u = m0·x + m3·y + m6 and v = m1·x + m4·y + m7 for each unrounded projected point, over the shifted sizes.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 7

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