FindBandSegment
function · lighting · primitive
- Address
0x6d63e0· 149 bytes, up to0x6d6474- Meaning
- Finds the band keys around half-minute h and the fraction between them
- Confidence
- verified, proof one
- Finding
- lighting/daynight#key-search
- Test
lighting::dn_band_find_frac_difftest
Finding: Key search in lighting: day-night
0x6d63e0 finds the segment of a band's keys that holds h, and its fraction. Starting from key 0
it takes the next key, i + 1 modulo the count, and accepts the pair when the next key's time is
greater and keys[i] ≤ h ≤ keys[next]; when the next time is not greater the pair wraps midnight
and accepts h ≥ keys[i] or h ≤ keys[next], adding 2880 to the next time and, below keys[i], to h.
The fraction is (h − keys[i]) / (keys[next] − keys[i]) in integers, divided at 53 bits and rounded
to a float. With no keys it writes i = next = 0 and fraction 0; a single key is its own pair.
The derivation is in the doc.
Callers 2
- EvalLightIntBand lighting
- EvalLightFloatBand lighting
Callees 0
None by a direct call or jump.
Calls and jumps by a bare address, from tables/calls.tsv.