Files
ClassicAPI/docs
Brues fb17670e37 feat(model): scene:SetWorldTerrain, a map's ADT terrain in a ModelScene
scene:SetWorldTerrain(mapID, x, y [, radius]) shows the map's ground around
a point, in map coordinates (radius default one tile, 533.33331 at
0x0080654C); scene:ClearWorldTerrain() removes it. The Gurubashi Arena's
pit is terrain under its WMO, so SetWorldModel at the arena's MODF plus
SetWorldTerrain shows it as the world does.

The chunks are the world's CMapChunk objects, owned by the scene and built
and drawn by the world's own functions (model/SceneTerrain.cpp):

- Load: the ADT is read whole and its MHDR read as ParseAreaFile
  (0x006C2010) reads it. LoadAreaTextures (0x006C20E0) fills an area
  stand-in's texture slots. Each chunk is constructed (0x006AF1D0), gets
  CreateAreaChunk's fields (0x006C2880) and the self-contained steps of
  CMapChunk::Load (0x006AF5F0) in order: FixupRecordPointers, header
  fields, BuildVertices, LoadNormals, the impassable flag, AddLayer,
  CreateShadowTexture, CreateCombinedTexture. LinkNeighbours (global area
  table), LoadReferences (the world's doodad hashes), LinkLights and the
  area's filing are world state and left out; the scene links its own
  chunks by LinkNeighbours' rule. Each record is bounds-checked first.
- Buffers: the world's chunk pool is freed and rebuilt on a far clip change
  or map unload (CreateChunkBufferPool 0x006AE640), and only the world's
  listed chunks give theirs back; its empty-pool fallback is the device's
  shared dynamic buffer. The scene makes its own static pools the same way
  (CreatePool 0x0058A160, PoolBuffer 0x00589F80; freed by 0x0058A040 and
  GxBufferRelease), which SelectMesh never trades away (it re-acquires only
  for a usage 2 pool).
- Draw, before the WMO: DrawChunkPass (0x00684510) per chunk the scene's
  volume shows (IsBoxCulled 0x00682F40): the chunk level and view depth
  (0x006AFAD0), the world transform at the chunk less the eye, a lighting
  record at the chunk's centre with the scene's lights there, the scene's
  fog and, when the depth less twice the radius is inside the fog end, its
  light as the sun (DrawMapEntity's slots 0x006C0CC0), then SelectMesh
  (0x006BEB50). DrawLayers reads the camera (0x00C7CF20) and fog end
  (0x00C62964) globals, which hold the scene's values while it draws. The
  anisotropic mip bias is the pass's own immediate (0x00684528).
- Teardown: UnloadChunk (0x006A6B10) and ~CMapChunk, the scene's buffers,
  then each tile's texture handles (HandleClose, as UnloadArea does).
- The chunks are built again when the terrain shader flags, shadowLevel or
  map shadows change (glue screen to world).

Not yet: collision, the tile's doodads and grass, terrain liquid.
2026-11-11 22:06:51 -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