M2Lighting
struct · models · 436 bytes
- Meaning
- Holds the lights an instance draws with: nearest point lights, sums, harmonic terms, fog, clip plane
- Confidence
- verified, proof one
- Finding
- models/lights#lighting-record
Finding: Lighting record in models: lights
0x71bc30(scene, position) zeroes a record and stores its scene and position. The record holds
up to four point lights with their squared distances, the summed ambient and directional colours,
27 spherical harmonic terms (nine per channel), the fog and the clip plane.
| offset | holds |
|---|---|
+0x004 | position |
+0x014 | flags: 1 lights in view space, 2 dominant light derived, 4 constants packed |
+0x018, +0x024, +0x030 | directional sums colour·direction for red, green, blue |
+0x03c, +0x048 | luminance-weighted direction sum, directional colour sum |
+0x054 | ambient sum |
+0x060, +0x078 | dominant light colour and direction |
+0x06c | third colour sum |
+0x084, +0x0a8, +0x0cc | spherical harmonic terms for red, green, blue |
+0x0f0 | seven packed constant vectors |
+0x160, +0x170, +0x180 | nearest point lights, their squared distances, their count |
+0x184 to +0x190 | fog start, fog end, 1/(end − start), fog colour |
+0x19c, +0x1a0 | clip plane flag, plane |
The derivation is in the doc.
Fields 21
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 4 | M2Scene * | m_scene | Holds the scene the record gathers lights from | verified, proof one | models/lights#lighting-record |
0x0004 | 12 | float[3] | m_position | Holds the position the record is lit at | verified, proof one | models/lights#lighting-record |
0x0014 | 4 | uint32_t | m_flags | Holds what is derived: 1 lights in view space, 2 dominant light, 4 packed constants | verified, proof one | models/lights#lighting-record |
0x0018 | 36 | float[9] | m_directionalSums | Holds the per-channel sums of colour times direction, three vectors | verified, proof one | models/lights#spherical-harmonic-terms |
0x003c | 12 | float[3] | m_luminanceDirection | Holds the sum of luminance times direction over the directional lights | verified, proof one | models/lights#spherical-harmonic-terms |
0x0048 | 12 | float[3] | m_directionalColor | Holds the sum of the directional colours | verified, proof one | models/lights#spherical-harmonic-terms |
0x0054 | 12 | float[3] | m_ambient | Holds the summed ambient colour | verified, proof one | models/lights#lighting-record |
0x0060 | 12 | float[3] | m_dominantColor | Holds the dominant light colour | verified, proof one | models/lights#dominant-light |
0x006c | 12 | float[3] | m_thirdColor | Holds the sum of the lights' third colours | verified, proof one | models/lights#spherical-harmonic-terms |
0x0078 | 12 | float[3] | m_dominantDirection | Holds the dominant light direction | verified, proof one | models/lights#dominant-light |
0x0084 | 108 | float[27] | m_shTerms | Holds the nine harmonic terms of red, green and blue | verified, proof one | models/lights#spherical-harmonic-terms |
0x00f0 | 112 | float[28] | m_shConstants | Holds the seven packed harmonic constant vectors | verified, proof one | models/lights#harmonic-constants |
0x0160 | 16 | M2Light *[4] | m_nearLights | Holds the nearest point lights as a max-heap | verified, proof one | models/lights#lighting-record |
0x0170 | 16 | float[4] | m_nearDistances | Holds the squared distances of the nearest point lights | verified, proof one | models/lights#lighting-record |
0x0180 | 4 | uint32_t | m_nearCount | Holds the number of nearest point lights | verified, proof one | models/lights#lighting-record |
0x0184 | 4 | float | m_fogStart | Holds the fog start | verified, proof one | models/lights#lighting-record |
0x0188 | 4 | float | m_fogEnd | Holds the fog end | verified, proof one | models/lights#lighting-record |
0x018c | 4 | float | m_fogScale | Holds 1/(fog end - fog start) | verified, proof one | models/lights#lighting-record |
0x0190 | 12 | float[3] | m_fogColor | Holds the fog colour | verified, proof one | models/lights#lighting-record |
0x019c | 4 | uint32_t | m_hasClipPlane | Holds whether the record carries a clip plane | verified, proof one | models/lights#view-space-lights |
0x01a0 | 16 | float[4] | m_clipPlane | Holds the clip plane normal and distance | verified, proof one | models/lights#view-space-lights |