Files
ClassicAPI/docs
Brues 930f969cd6 feat(model): the terrain's water and lava in a scene
A scene's terrain now shows the rivers, lakes, ocean and lava of its
chunks, drawn by the world's own liquid code.

Load: after LoadNormals, each chunk runs CMapChunk::LoadLiquids
(0x006AF760), which reads one MCLQ block (0x324 bytes) per liquid flag
of the MCNK header into the four slots at chunk +0x118 and builds each
slot's vertices. The record check now bounds the MCLQ blocks too.

Buffers: the slots take a vertex and an index buffer from two static
pools the scene makes, as CreateLiquidBufferPool (0x0068CA50) makes the
world's (81 vertices of 40 bytes, 192 indices). The world rebuilds its
own pool, which would leave the scene's slots on freed buffers;
CChunkLiquid::Draw (0x0068DE40) re-acquires only for a usage-2 pool.
Each pair is marked unfilled with 0x0058A130, the call
AcquireLiquidBuffers (0x0068CC60) makes, so the first draw fills the
vertices and the strip.

Draw: the three passes are copied in the world's order. Magma
(DrawMagmaPass 0x006855A0: no culling, lighting or blending) after the
WMO, as DrawWorldScene has it; the ocean (0x00685010) then the river
(0x006851B0) before the WMO's liquids, as RenderLiquid (0x006816D0)
has it. Each pass binds its swatch, then the water program
(0xC81B7C) with the white specular and the shininess (0x8102E8) and
alpha blend when fancy water (0xC9A324) is on, else the add combine
on stage 1. A slot is culled by its box (0x0068DF40: the chunk's box
with the slot's heights as z), placed at its chunk less the eye, lit
as GatherSlotLights (0x0068DF70) lights it, and drawn with the pass.
The camera, fog end, frustum and world stack are staged as for the
chunks (one Staged helper now serves all three).

Colours: the river and ocean swatches refill from the light state
while their fresh flags (0xC8117C, 0xC81B70) are clear. World::MapWater
swaps the eight water fields of the live light record (+0x34..+0x40,
+0x68..+0x74) for the scene map's at the eye; the flags are cleared
before and after the draw, so the swatches take the scene's colours
and the world's next frame refills its own. The WMO's water uses the
same swap.

Actors do not swim in this water yet, and GetLiquidAtPoint does not
find it.
2026-11-12 00:07:07 -06:00
..
2026-05-07 15:08:45 -05:00
2026-05-07 15:52:48 -05:00
2026-05-10 00:10:06 -05:00
2026-05-07 16:28:32 -05:00
2026-05-07 12:23:57 -05:00
2026-05-07 15:08:45 -05:00
2026-05-07 15:08:45 -05:00
2026-05-09 14:23:40 -05:00