benilla-re systems structs docs

ProjectPortal

function · terrain · primitive

Address
0x6b46f0 · 882 bytes, up to 0x6b4a61
Signature
uint8_t __thiscall (void *this, uint32_t arg2, uint32_t arg3, uint32_t arg4)
Meaning
Stores a portal's clipped screen rectangle, or drops the portal when nothing of it is on screen
Confidence
verified, proof one
Finding
terrain/portals#portal-projection
Test
terrain::portal_screen_rect_difftest

Finding: Portal projection in terrain: map object visibility

0x6b46f0(portal, state) stores in the state the portal's screen rectangle and flags. Each vertex goes through the object-to-clip matrix 0xcbe2d8, the polygon (x, y, w) is clipped, and nothing left sets flag 1 (the portal is dropped). When the camera lies within 0.01 of the portal's plane inside its polygon, the rectangle is the whole screen (−1, −1, 1, 1). Otherwise it is the bounds of x/w and y/w over the clipped vertices, with |w| below 0.001 replaced by 1e-5.

The derivation is in the doc.

Callers 1

Callees 5

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