benilla-re systems structs docs

CMapChunk::BuildVertices

function · terrain · primitive

Address
0x6b0e50 · 767 bytes, up to 0x6b114e
Signature
void __thiscall (CMapChunk *this)
Meaning
Writes the 145 chunk-relative vertices from MCVT and the chunk's box, centre and radius
Confidence
verified, proof one
Finding
terrain/chunk#chunk-vertices
Test
terrain::mcvt_world_verts

Finding: Chunk vertices in terrain: chunk

CMapChunk::BuildVertices (0x6b0e50) writes 145 vertices relative to the chunk position: nine rows of nine outer vertices, each but the last followed by eight inner ones. With g the chunk's global row (+0x90) and h its global column (+0x8c), and every step stored as a float,

o(n) = 17066.666 − n·33.333332, sx = −(o(g) − o(g+1))/8, sy = −(o(h) − o(h+1))/8.

Outer vertex (j, i) is (j·sx, i·sy, z); inner vertex (j, i) is (j·sx + sx/2, i·sy + sy/2, z), with z the next MCVT float copied unchanged. The box is the vertices' minimum and maximum plus the position; the centre is (min + max)/2 and the radius |max − centre|.

The derivation is in the doc.

Callers 1

Callees 3

Calls and jumps by a bare address, from tables/calls.tsv.