benilla-re systems structs docs

s_meshKeyLevelShift

global · terrain

Address
0x86c2f4 · 4 bytes, up to 0x86c2f7
Type
uint32_t
Meaning
Holds 16, the key shift of a chunk's own level
Confidence
verified, proof one
Finding
terrain/lod#chunk-mesh-selection

Finding: Chunk mesh selection in terrain: lod

0x6beb50(draw) keys a chunk's mesh. The key is the level shifted by 16. With world flag 4 each of the four neighbours (+0xc4 to +0xd0: y − 1, x + 1, y + 1 and x − 1 in the tile's chunk grid) of a strictly higher level adds that level to the key shifted by 0, 4, 8 and 12, and to the caps word shifted by 0, 8, 16 and 24; a lower or equal neighbour adds nothing. A changed key invalidates both buffers and is stored at +0xbc.

The derivation is in the doc.