BuildPortalVolume
function · terrain · primitive
- Address
0x682930· 1119 bytes, up to0x682d8e- Signature
void __fastcall (void *out, const float *rect)- Meaning
- Builds a frustum through a portal's screen rectangle
- Confidence
- inferred
- Finding
- terrain/scene#portal-volumes
- Test
terrain::frustum_push_rect_difftest
Finding: Portal volumes in terrain: scene
A volume is six planes, 16 bytes each (n, d), then eight corners from +0x60, 12 bytes apart. The corners
are in the frustum corner order: c0 to c3 on the near plane (bottom-left, top-left, top-right, bottom-right) and
c4 to c7 the same on the far plane. 0x682930 makes the eight corners of a portal window from the frustum
rays: two passes of four corners, each narrowed to the window's rectangle. It hands them to 0x6865f0, which
copies them to the volume at the top of the frustum stack and builds the planes with 0x686640, then sorts a local
copy of the corners that nothing reads.
| plane | side | normal | d = −n·anchor |
|---|---|---|---|
| 0 | top | (c5 − c1) × (c6 − c1) | c1 |
| 1 | bottom | (c7 − c0) × (c4 − c0) | c0 |
| 2 | left | (c4 − c0) × (c5 − c0) | c0 |
| 3 | right | (c6 − c3) × (c7 − c3) | c3 |
| 4 | far | (c4 − c5) × (c6 − c5) | c5 |
| 5 | near | −(plane 4 normal) | c2 |
The derivation is in the doc.
Callers 4
- CullLowDetailTiles terrain
- SeedInteriorVisibility terrain
- SeedExteriorVisibility terrain
- WalkPortals terrain
Callees 6
- __ehvec_dtor crt
- SplatVector3 loadingscreen
- SetVector3 spline
- ScaleVector3 objectlayer
- AddVector3 objectlayer
- SetConvexVolume terrain
Calls and jumps by a bare address, from tables/calls.tsv.