benilla-re systems structs docs

ApplyMapLighting

function · terrain · primitive

Address
0x6a7300 · 833 bytes, up to 0x6a7640
Signature
void __thiscall (void *this, void *target)
Meaning
Adds an entity's directional, ambient, interior fog and point lights to a model's lighting record
Confidence
verified, proof one
Finding
terrain/lights#entity-lighting
Test
terrain::apply_map_exterior_difftest, terrain::apply_map_b1_dir_scaled_difftest, terrain::apply_map_b2_daynight_blend_difftest, terrain::apply_map_b3_normalize_difftest, terrain::apply_map_b4_b5_colors_difftest

Finding: Entity lighting in terrain: map lights

0x6a7300 adds an entity's light to a model's lighting record (the stack argument). With +0xc bit 4 (lit by the sun) it adds the scene light block's directional colour times the intensity +0xa4, with the block's direction. Otherwise the colour is the entity's +0xa0 bytes, as byte / 255, times +0xa4, and the direction the global one 0xca816c, or with +0x90 bit 0x800 the global direction plus (sun direction − global) × (+0xa3 / 255), normalized. It also adds the ambient +0x9c and each point light of the entity's list, and sets the interior fog on the record when the camera's fog claim is the entity's map object.

The derivation is in the doc.

Callers 0

None by a direct call or jump.

Callees 8

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