benilla-re systems structs docs

CMapObj::CrossPortals

function · models · primitive

Address
0x6a3f80 · 639 bytes, up to 0x6a41fe
Signature
uint8_t __thiscall (CMapObj *this, const float *segment, float *fraction, uint32_t *groups)
Meaning
Finds the nearest portal a segment crosses and the two groups beside it
Confidence
verified, proof one
Finding
models/wmo#portal-crossing
Test
models::portal_extent_scale_difftest, models::portal_plane_side_difftest, models::portal_result_scale_difftest, models::portal_seg_normalize_difftest

Finding: Portal crossing in models: map objects

0x6a3f80(segment, fraction, groups) finds the nearest portal a segment crosses and the two groups beside it. The ray runs from the segment's start along its unit direction for length × fraction. For each group the segment's box meets and each of its portal references, the portal plane meets the ray with tolerance 0.1; a hit at 0 or more and at most the shortest so far, inside the portal polygon, becomes the shortest. The first group out is the reference's own group when (n·start + d ≥ 0) equals (side > 0), else its other group; the second is the other. The fraction becomes the shortest over the length; the result is 1 when a portal counted.

The derivation is in the doc.

Callers 1

Callees 7

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