BuildConvexPlanes
function · terrain · primitive
- Address
0x686640· 477 bytes, up to0x68681c- Signature
void __thiscall (void *this)- Meaning
- Builds a volume's six planes from its eight corners: top, bottom, left, right, far, near
- Confidence
- verified, proof one
- Finding
- terrain/scene#portal-volumes
- Test
terrain::side_plane_d_negate_difftest,terrain::plane5_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
- BuildProjectorVolume terrain
- InitConvexVolume terrain
- SetConvexVolume terrain
- TransformConvexVolume terrain
Callees 5
- SubtractVector3 ui
- DotVector3 objectlayer
- PlaneFromTriangle collision
- NormalizeVector3 terrain
- CrossVector3 terrain
Calls and jumps by a bare address, from tables/calls.tsv.