M2LightingBuildShConstants
function · models · primitive
- Address
0x71c4e0· 582 bytes, up to0x71c725- Signature
void __thiscall (M2Lighting *this, float *out)- Meaning
- Packs a lighting record's harmonic terms into seven constant vectors, once, and copies them out
- Confidence
- verified, proof one
- Finding
- models/lights#harmonic-constants
- Test
models::sh_light_pack_difftest
Finding: Harmonic constants in models: lights
The terms become seven vectors at +0xf0, built once per record (flag 4) and copied out. For each
channel with terms L:
| vector | x | y | z | w |
|---|---|---|---|---|
| A (0–2) | −0.325735·L3 | −0.325735·L1 | 0.325735·L2 | 0.2820948·L0 − 0.0788479·L6 |
| B (3–5) | 0.2731371·L4 | −0.2731371·L5 | 0.2365437·L6 | −0.2731371·L7 |
| C (6) | 0.1365686·L8 red | green | blue | 1.0 |
M2DrawSetLighting puts them in vertex constants c10–c16 or pixel constants c1–c7
(render#lighting-lanes).
The derivation is in the doc.
Callers 1
- M2DrawSetLighting models
Callees 0
None by a direct call or jump.
Calls and jumps by a bare address, from tables/calls.tsv.