M2PackLightColor
function · models · primitive
- Address
0x71ca80· 439 bytes, up to0x71cc36- Signature
void __fastcall (uint32_t *out, float *scale, const float *colour, float alpha)- Meaning
- Packs a colour scaled by its largest component into a device colour and returns that component
- Confidence
- verified, proof one
- Finding
- models/lights#fixed-function-lights
- Test
models::m2_light_color_pack_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 1
- M2LightingSetDeviceLights models
Callees 1
- __ftol crt
Calls and jumps by a bare address, from tables/calls.tsv.