benilla-re systems structs docs

ClipPortalPolygon

function · terrain · primitive

Address
0x6b4a80 · 636 bytes, up to 0x6b4cfb
Signature
uint32_t __thiscall (void *this, const float *in, uint32_t count, float *out, uint32_t arg5)
Meaning
Clips a polygon of x, y, w triples against the four guard planes of the screen square
Confidence
verified, proof one
Finding
terrain/portals#portal-polygon-clip
Test
terrain::poly_clip, terrain::portal_screen_rect_difftest

Finding: Portal polygon clip in terrain: map object visibility

0x6b4a80(polygon, count, out pointer, out count) clips a polygon of (x, y, w) triples against the four guard planes in turn and returns 0 vertices when one removes everything. The planes (1, 0, 1), (−1, 0, 1), (0, 1, 1) and (0, −1, 1) over √2 hold the points |x| and |y| at most w. A vertex is inside when its distance exceeds 0.01, on the plane within ±0.01 and outside below −0.01; an inside vertex followed by an outside one, or the reverse, adds the intersection.

The derivation is in the doc.

Callers 1

Callees 1

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