benilla-re systems structs docs

MapObjPortalPointDistance

function · models · primitive

Address
0x6c4240 · 248 bytes, up to 0x6c4337
Signature
float __thiscall (CMapObj *this, const NTempest::C3Vector *point, const void *portal)
Meaning
Returns 0 for a point near a portal's plane inside it, else its least distance to the portal's edges
Confidence
verified, proof one
Finding
models/wmo#portal-vertex-fade
Test
models::aabsp_nearest_dist_difftest

Finding: Portal vertex fade in models: map objects

When a group's MOCV colours are read, every vertex of a face whose MOPY flags lack bit 0 gets alpha 0xff, unless a global switch is set. On the group's first draw, each vertex up to the highest vertex of the batches its first batch count covers is faded toward the outside: d is its least distance to a portal of the group that leads to a group with flags 0x8 or 0x40. At d = 0 the colour becomes 0xffffffff; for 0 < d < 6.666667 with alpha 0, with t = 1 − 0.15·d, each of r, g, b becomes c + (255 − c)·t and alpha 255·t, each byte taken as (x + 512) >> 14.

The derivation is in the doc.

Callers 1

Callees 3

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