benilla-re systems structs docs

s_portalPolygon

global · terrain

Address
0xcbe4c0 · 192 bytes, up to 0xcbe57f
Type
float[48]
Meaning
Holds the 12 clip-space vertices of the portal being projected
Confidence
verified, proof one
Finding
terrain/portals#portal-projection

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.