benilla-re systems structs docs

M2LightingSetDeviceLights

function · models · primitive

Address
0x71c730 · 846 bytes, up to 0x71ca7d
Signature
void __thiscall (M2Lighting *this, const float *origin, uint32_t fog)
Meaning
Sets the device's four fixed-function lights, and optionally its fog, from a lighting record
Confidence
verified, proof one
Finding
models/lights#fixed-function-lights
Test
models::driver_clamp_pack_difftest, models::driver_mag_gate_difftest, models::driver_vec_diff_difftest

Finding: Fixed-function lights in models: lights

Without vertex shaders a record reaches the device as four lights. Slot 0 is the dominant light: a directional light along +0x78 with ambient +0x54, diffuse +0x60 and third colour +0x6c. Slots 1 to 3 take the nearest point lights from the end of the heap backward, so with four the heap root, the farthest, is left out: diffuse from the light's +0x3c, no ambient or third colour, attenuation +0x54 to +0x5c, at +0x18 (view space) or at +0xc minus the caller's origin. Unused slots are disabled. A colour reaches the device as an ARGB word divided by its largest component, alpha included, with that largest value as the light's scale.

The derivation is in the doc.

Callers 6

Callees 9

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