wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::adt Namespace Reference

Namespaces

namespace  chunks
 ADT chunk binary structs (the MCNK cell header, texture layers, liquid records, flying bounds) and their flag enums.
namespace  detail

Classes

struct  ADTBase
 The version-agnostic base of every ADT<V> (welded as "ADT"): the language bindings attach for_version/read/write/convert here. More...
struct  LiquidInstance
 One liquid layer of one terrain cell, fully decoded (an MH2O instance). More...
struct  MapChunkBase
 The version-agnostic base of every MapChunk<V> (welded as "MapChunk"): the language bindings attach for_version here and give the per-version chunks a common welded supertype. More...
struct  MapChunkLiquid
 All liquid of one terrain cell: the attribute masks plus its layers. More...
struct  MCLQData
 The legacy per-chunk liquid (MCLQ, up to and including WotLK): a 9x9 vertex grid, an 8x8 tile-flag grid and up to two flow vectors, decoded. More...
struct  MH2OData
 The whole-tile MH2O chunk: liquid for each of the 256 cells, decoded. More...

Typedefs

template<ClientVersion V>
using ADT = detail::ADT<canonicalVersion(V, AdtPivots, AdtVersions)>
 A terrain tile — the canonicalizing face of detail::ADT.
template<ClientVersion V>
using MapChunk = detail::MapChunk<canonicalVersion(V, MapChunkPivots, AdtVersions)>
 A terrain chunk — the canonicalizing face of detail::MapChunk: every client version collapses to its range's first grid version (MapChunkPivots).

Enumerations

enum class  AlphaFormat : std::uint8_t { Lowres4Bit = 0 , Highres8Bit = 1 }
enum class  FileKind : std::uint8_t {
  Monolithic = 0 , Root = 1 , Tex0 = 2 , Obj0 = 3 ,
  Obj1 = 4 , Lod = 5
}
 Which physical ADT file a chunk's portion belongs to. More...
enum class  InFile : std::uint8_t { Root , Tex , Obj }
 The physical-file group a binary chunk (tile-level or MCNK sub-chunk) is routed to on write; the monolithic file carries every group. More...

Functions

consteval detail::InFileSpec inFile (InFile file)
 Annotate a binary chunk member with the physical file it is routed to on write (the monolithic file carries every group).
consteval detail::SerializerSpec serializedBy (std::meta::info codec)
 Annotate a sub-chunk member with a MapChunk-context codec (a struct with static read(self, span, ReadCtx) / write(self, out, WriteCtx) / engaged(self, WriteCtx) templates) instead of the default uniform transfer.
constexpr bool routesTo (InFile file, FileKind kind)
 Whether a member routed to file participates in physical file kind: the monolithic file carries every group, each split file only its own.
constexpr bool fileHasHeader (FileKind kind)
 Whether a given physical file carries the 128-byte MCNK header (the root or the pre-Cata monolithic file).

Variables

constexpr std::uint32_t AdtVersion18 = 18
 The ADT format version every supported client writes (the MVER payload).
constexpr std::size_t ChunksPerTile = 16 * 16
 The terrain chunks a tile is divided into: a 16x16 grid, indexed row-major (y * 16 + x) — the client addresses them positionally, so the count is fixed for every version.
constexpr ClientVersion AdtTexFdids = builds::BfA_TidesOfVengeance_28294
 8.1.0.27826: MDID/MHID diffuse+height FileDataID tables arrive in _tex0 (MTEX still present this one build).
constexpr ClientVersion AdtSplit = builds::Cata
 Cataclysm: ADTs split into root/_tex0/_obj0 (+_obj1); MCIN gone, MCLV / MCRD / MCRW / MAMP / MCMT arrive.
constexpr std::array AdtVersions
 The versions ADT is instantiated (and welded) for: every targeted last-minor-of-major release, in release order.
constexpr std::array MapChunkPivots {builds::WotLK, builds::Cata}
 MapChunk<V> content pivots — only boundaries that change what a chunk CURRENTLY carries: WotLK (MCCV vertex colors arrive) and Cata (MCLV baked lighting + MCMT materials arrive, and the legacy MCLQ liquid is finally gone).
constexpr std::array AdtPivots {builds::TBC, builds::WotLK, builds::Cata, AdtTexFdids}
 ADT<V> assembly content pivots — only boundaries that change what the tile CURRENTLY carries: TBC (MFBO), WotLK (MH2O/MTXF/MCCV), Cata (split files, MAMP, obj1/lod), 8.1 (MDID/MHID FileDataID texture tables).

Typedef Documentation

◆ ADT

A terrain tile — the canonicalizing face of detail::ADT.

Definition at line 339 of file adt.hpp.

◆ MapChunk

A terrain chunk — the canonicalizing face of detail::MapChunk: every client version collapses to its range's first grid version (MapChunkPivots).

Definition at line 676 of file map_chunk.hpp.

Enumeration Type Documentation

◆ AlphaFormat

enum class wowlib::formats::adt::AlphaFormat : std::uint8_t
strong
Enumerator
Lowres4Bit 

2048-byte 4-bit alpha maps (the default when the WDT sets neither big-alpha flag).

Highres8Bit 

4096-byte 8-bit alpha maps (the WDT has adt_has_big_alpha or adt_has_height_texturing).

Definition at line 85 of file boundaries.hpp.

◆ FileKind

enum class wowlib::formats::adt::FileKind : std::uint8_t
strong

Which physical ADT file a chunk's portion belongs to.

Pre-Cata tiles are one monolithic file carrying every chunk; Cata+ tiles distribute chunks over the split ADT files (root/_tex0/_obj0/_obj1/_lod).

Enumerator
Monolithic 

The single pre-Cataclysm .adt (every chunk).

Root 

The Cata+ root .adt (terrain heights/normals/colors, liquid, sounds).

Tex0 

The Cata+ _tex0.adt (texture layers, alpha/shadow maps, materials).

Obj0 

The Cata+ _obj0.adt (doodad/object references and placements).

Obj1 

The Cata+ _obj1.adt (level-of-detail object placements).

Lod 

The Legion+ _lod.adt (low-detail geometry and liquids).

Definition at line 72 of file map_chunk.hpp.

◆ InFile

enum class wowlib::formats::adt::InFile : std::uint8_t
strong

The physical-file group a binary chunk (tile-level or MCNK sub-chunk) is routed to on write; the monolithic file carries every group.

Used by both ADT tile chunks and MapChunk sub-chunks via the inFile() annotation.

Enumerator
Root 

The root .adt (header, terrain, water, sounds, flying bounds).

Tex 

The _tex0.adt (textures, layers, alpha/shadow maps, materials).

Obj 

The _obj0.adt (model/WMO names, placements, references).

Definition at line 85 of file map_chunk.hpp.

Function Documentation

◆ fileHasHeader()

bool wowlib::formats::adt::fileHasHeader ( FileKind kind)
constexpr

Whether a given physical file carries the 128-byte MCNK header (the root or the pre-Cata monolithic file).

Parameters
kindthe physical file.
Returns
true for the monolithic and root files.

Definition at line 139 of file map_chunk.hpp.

References Monolithic, and Root.

Referenced by wowlib::formats::adt::detail::MapChunk< V >::readFrom(), wowlib::formats::adt::detail::ADT< V >::writeFile(), and wowlib::formats::adt::detail::MapChunk< V >::writeTo().

◆ inFile()

detail::InFileSpec wowlib::formats::adt::inFile ( InFile file)
consteval

Annotate a binary chunk member with the physical file it is routed to on write (the monolithic file carries every group).

Parameters
filethe physical-file group.
Returns
the annotation payload.

Definition at line 109 of file map_chunk.hpp.

◆ routesTo()

bool wowlib::formats::adt::routesTo ( InFile file,
FileKind kind )
constexpr

Whether a member routed to file participates in physical file kind: the monolithic file carries every group, each split file only its own.

Parameters
filethe member's routing group.
kindthe physical file being read/written.
Returns
whether the member participates.

Definition at line 125 of file map_chunk.hpp.

References Monolithic, Obj, Obj0, Root, Tex, and Tex0.

Referenced by wowlib::formats::adt::detail::ADT< V >::writeFile(), and wowlib::formats::adt::detail::MapChunk< V >::writeTo().

◆ serializedBy()

detail::SerializerSpec wowlib::formats::adt::serializedBy ( std::meta::info codec)
consteval

Annotate a sub-chunk member with a MapChunk-context codec (a struct with static read(self, span, ReadCtx) / write(self, out, WriteCtx) / engaged(self, WriteCtx) templates) instead of the default uniform transfer.

Parameters
codecthe reflection of the codec type, e.g. ^^AlphaCodec.
Returns
the annotation payload.

Definition at line 116 of file map_chunk.hpp.

Variable Documentation

◆ AdtPivots

std::array wowlib::formats::adt::AdtPivots {builds::TBC, builds::WotLK, builds::Cata, AdtTexFdids}
inlineconstexpr

ADT<V> assembly content pivots — only boundaries that change what the tile CURRENTLY carries: TBC (MFBO), WotLK (MH2O/MTXF/MCCV), Cata (split files, MAMP, obj1/lod), 8.1 (MDID/MHID FileDataID texture tables).

MoP/WoD add no modeled tile chunks, and _obj1/_lod stay raw until stage 3, so Legion and SL are not yet pivots. Ranges: Vanilla / tbc / wotlk / CataToLegion / BfaPlus.

Definition at line 81 of file boundaries.hpp.

◆ AdtSplit

ClientVersion wowlib::formats::adt::AdtSplit = builds::Cata
inlineconstexpr

Cataclysm: ADTs split into root/_tex0/_obj0 (+_obj1); MCIN gone, MCLV / MCRD / MCRW / MAMP / MCMT arrive.

Definition at line 39 of file boundaries.hpp.

◆ AdtTexFdids

ClientVersion wowlib::formats::adt::AdtTexFdids = builds::BfA_TidesOfVengeance_28294
inlineconstexpr

8.1.0.27826: MDID/MHID diffuse+height FileDataID tables arrive in _tex0 (MTEX still present this one build).

Definition at line 35 of file boundaries.hpp.

◆ AdtVersion18

std::uint32_t wowlib::formats::adt::AdtVersion18 = 18
inlineconstexpr

The ADT format version every supported client writes (the MVER payload).

Definition at line 24 of file boundaries.hpp.

Referenced by wowlib::formats::adt::detail::ADT< V >::writeFile().

◆ AdtVersions

std::array wowlib::formats::adt::AdtVersions
inlineconstexpr
Initial value:
{
}
constexpr ClientVersion Shadowlands
constexpr ClientVersion Tww
constexpr ClientVersion Bfa
constexpr ClientVersion Mop
constexpr ClientVersion Wod
constexpr ClientVersion Tbc
constexpr ClientVersion Vanilla
constexpr ClientVersion Legion
constexpr ClientVersion Dragonflight
constexpr ClientVersion Cata
constexpr ClientVersion Wotlk

The versions ADT is instantiated (and welded) for: every targeted last-minor-of-major release, in release order.

Definition at line 45 of file boundaries.hpp.

Referenced by wowlib::audit::detail::FormatDrivers::adt().

◆ ChunksPerTile

std::size_t wowlib::formats::adt::ChunksPerTile = 16 * 16
inlineconstexpr

The terrain chunks a tile is divided into: a 16x16 grid, indexed row-major (y * 16 + x) — the client addresses them positionally, so the count is fixed for every version.

Definition at line 29 of file boundaries.hpp.

Referenced by wowlib::formats::adt::detail::ADT< V >::validate().

◆ MapChunkPivots

std::array wowlib::formats::adt::MapChunkPivots {builds::WotLK, builds::Cata}
inlineconstexpr

MapChunk<V> content pivots — only boundaries that change what a chunk CURRENTLY carries: WotLK (MCCV vertex colors arrive) and Cata (MCLV baked lighting + MCMT materials arrive, and the legacy MCLQ liquid is finally gone).

The legacy MCLQ liquid is NOT removed at WotLK — Outland tiles keep shipping it in 3.3.5a and the exact removal build is unknown, so it stays available through WotLK (see map_chunk.hpp). MoP MCBB/MPTX and later per-chunk sub-chunks are not modeled yet; add their pivots when they are (a no-op pivot would just over-instantiate). Ranges: VanillaToTbc / wotlk / CataPlus.

Definition at line 73 of file boundaries.hpp.