|
wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
|
A terrain tile for one client version. More...
#include <wowlib/formats/adt/adt.hpp>
Public Member Functions | |
| Result< void > | read (fs::FileSystem &fs, const FileKey &key, AlphaFormat alpha) |
| Load the tile — every split file present — from a client filesystem, replacing this entity's contents. | |
| Result< void > | write (fs::FileSystem &fs, const FileKey &key, AlphaFormat alpha) const |
| Serialize the tile (and, Cata+, every split file) through the filesystem's project overlay; the file names derive from the key, which must resolve to a path. | |
| ValidationReport | validate () const |
| Result< void > | ensureValid () const |
| Validate and raise on the first error instead of returning a report — the assert-style face of validate(). | |
| Result< void > | parseFile (std::span< const std::byte > data, FileKind kind) |
| Parse one split file's chunk stream into this entity (merging), by reflecting over the chunk()-annotated members. | |
| Result< FileBuffer > | writeFile (FileKind kind, AlphaFormat alpha) const |
| Serialize one physical file of the tile (monolithic pre-Cata, or one of root/_tex0/_obj0), routing each chunk()-annotated member by its inFile group and stamping the derived MHDR/MCIN tables. | |
Public Attributes | |
| std::uint32_t | mver = AdtVersion18 |
| The ADT format version (MVER); 18 for every supported client. | |
| MHDRData | header {} |
| The tile header (MHDR): flags; the chunk offsets are derived. | |
| StringBlock | textures |
| The tileset texture filenames (MTEX): the paths MapChunk layers index. | |
| StringBlock | modelFilenames |
| The M2 model filenames (MMDX) placements reference by MMID index. | |
| std::vector< std::uint32_t > | modelNameOffsets |
| Byte offsets into model_filenames (MMID): a doodad placement's name_id indexes this list. | |
| StringBlock | wmoFilenames |
| The WMO filenames (MWMO) placements reference by MWID index. | |
| std::vector< std::uint32_t > | wmoNameOffsets |
| Byte offsets into wmo_filenames (MWID): a WMO placement's name_id indexes this list. | |
| std::vector< common::SMDoodadDef > | doodadPlacements |
| Doodad (M2) placements on this tile (MDDF). | |
| std::vector< common::SMMapObjDef > | wmoPlacements |
| WMO placements on this tile (MODF). | |
| std::vector< adt::MapChunk< V > > | chunks |
| The 256 terrain chunks (MCNK), row-major (index = y * 16 + x). | |
| AlphaFormat | alphaFormat = AlphaFormat::Lowres4Bit |
| How this tile's alpha maps were laid out on disk, recorded from the AlphaFormat passed to read(); write() takes its own explicit argument. | |
Static Public Attributes | |
| static constexpr ClientVersion | Version = V |
| static constexpr std::array | ChunkOrder |
| The canonical top-level chunk order (a superset; each physical file emits the subset routed to it, in this order — see writeFile). | |
A terrain tile for one client version.
Instantiate through the canonicalizing adt::ADT alias, never directly.
|
nodiscard |
Validate and raise on the first error instead of returning a report — the assert-style face of validate().
Definition at line 409 of file adt.hpp.
References validate().
| Result< void > wowlib::formats::adt::detail::ADT< V >::parseFile | ( | std::span< const std::byte > | data, |
| FileKind | kind ) |
Parse one split file's chunk stream into this entity (merging), by reflecting over the chunk()-annotated members.
| data | the file bytes. |
| kind | which split file it is. |
Definition at line 414 of file adt.hpp.
References alphaFormat, wowlib::formats::detail::annotation(), chunks, wowlib::ChunkTruncated, wowlib::formats::fourcc(), wowlib::formats::fourccToString(), wowlib::makeError(), wowlib::formats::detail::membersOf(), and wowlib::formats::detail::readValue().
Referenced by read().
| Result< void > wowlib::formats::adt::detail::ADT< V >::read | ( | fs::FileSystem & | fs, |
| const FileKey & | key, | ||
| AlphaFormat | alpha ) |
Load the tile — every split file present — from a client filesystem, replacing this entity's contents.
The alpha-map bit depth (from the map's WDT) is supplied by the caller.
| fs | the filesystem gateway |
| key | the tile identity (root .adt path and/or FileDataID) |
| alpha | the on-disk alpha-map bit depth for this tile's map (from its WDT MPHD flags) |
Definition at line 573 of file adt.hpp.
References alphaFormat, wowlib::builds::Cata, chunks, wowlib::makeError(), wowlib::formats::adt::Monolithic, wowlib::formats::adt::Obj0, parseFile(), wowlib::FileKey::path, wowlib::PathNotResolvable, wowlib::formats::adt::Root, and wowlib::formats::adt::Tex0.
|
nodiscard |
Definition at line 349 of file adt.hpp.
References wowlib::formats::ValidationReport::addError(), wowlib::formats::chunk(), chunks, wowlib::formats::adt::ChunksPerTile, doodadPlacements, wowlib::formats::common::EntryIsFdid, wowlib::formats::ValidationReport::full(), wowlib::formats::hasFlag(), modelNameOffsets, textures, wowlib::formats::detail::validateEntity(), wowlib::formats::detail::validateIndexElements(), wmoNameOffsets, and wmoPlacements.
Referenced by ensureValid().
| Result< void > wowlib::formats::adt::detail::ADT< V >::write | ( | fs::FileSystem & | fs, |
| const FileKey & | key, | ||
| AlphaFormat | alpha ) const |
Serialize the tile (and, Cata+, every split file) through the filesystem's project overlay; the file names derive from the key, which must resolve to a path.
The alpha-map bit depth to encode is supplied by the caller.
| fs | the filesystem gateway |
| key | the tile identity; must resolve to a path |
| alpha | the on-disk alpha-map bit depth to encode |
Definition at line 634 of file adt.hpp.
References wowlib::builds::Cata, wowlib::makeError(), wowlib::formats::adt::Monolithic, wowlib::formats::adt::Obj0, wowlib::FileKey::path, wowlib::PathNotResolvable, wowlib::formats::adt::Root, wowlib::formats::adt::Tex0, and writeFile().
| Result< FileBuffer > wowlib::formats::adt::detail::ADT< V >::writeFile | ( | FileKind | kind, |
| AlphaFormat | alpha ) const |
Serialize one physical file of the tile (monolithic pre-Cata, or one of root/_tex0/_obj0), routing each chunk()-annotated member by its inFile group and stamping the derived MHDR/MCIN tables.
| kind | which physical file to write. |
| alpha | the alpha-map bit depth to encode. |
Definition at line 466 of file adt.hpp.
References wowlib::formats::adt::AdtVersion18, wowlib::formats::detail::annotation(), ChunkOrder, chunks, wowlib::formats::adt::fileHasHeader(), wowlib::formats::fourcc(), header, wowlib::formats::detail::membersOf(), wowlib::formats::adt::Monolithic, wowlib::formats::adt::chunks::MHDRData::ofsMcin, wowlib::formats::adt::chunks::MHDRData::ofsMddf, wowlib::formats::adt::chunks::MHDRData::ofsMfbo, wowlib::formats::adt::chunks::MHDRData::ofsMh2O, wowlib::formats::adt::chunks::MHDRData::ofsMmdx, wowlib::formats::adt::chunks::MHDRData::ofsMmid, wowlib::formats::adt::chunks::MHDRData::ofsModf, wowlib::formats::adt::chunks::MHDRData::ofsMtex, wowlib::formats::adt::chunks::MHDRData::ofsMtxf, wowlib::formats::adt::chunks::MHDRData::ofsMwid, wowlib::formats::adt::chunks::MHDRData::ofsMwmo, wowlib::formats::adt::routesTo(), and wowlib::formats::detail::writeValue().
Referenced by write().
| AlphaFormat wowlib::formats::adt::detail::ADT< V >::alphaFormat = AlphaFormat::Lowres4Bit |
How this tile's alpha maps were laid out on disk, recorded from the AlphaFormat passed to read(); write() takes its own explicit argument.
wowlib always presents decoded 64x64 maps.
Definition at line 222 of file adt.hpp.
Referenced by parseFile(), and read().
|
staticconstexpr |
The canonical top-level chunk order (a superset; each physical file emits the subset routed to it, in this order — see writeFile).
MCIN and MCNK are positional placeholders the writer fills specially.
Definition at line 161 of file adt.hpp.
Referenced by writeFile().
| std::vector<adt::MapChunk<V> > wowlib::formats::adt::detail::ADT< V >::chunks |
The 256 terrain chunks (MCNK), row-major (index = y * 16 + x).
Definition at line 219 of file adt.hpp.
Referenced by parseFile(), read(), validate(), and writeFile().
| std::vector<common::SMDoodadDef> wowlib::formats::adt::detail::ADT< V >::doodadPlacements |
Doodad (M2) placements on this tile (MDDF).
Definition at line 212 of file adt.hpp.
Referenced by validate().
| MHDRData wowlib::formats::adt::detail::ADT< V >::header {} |
The tile header (MHDR): flags; the chunk offsets are derived.
Definition at line 188 of file adt.hpp.
Referenced by writeFile().
| StringBlock wowlib::formats::adt::detail::ADT< V >::modelFilenames |
| std::vector<std::uint32_t> wowlib::formats::adt::detail::ADT< V >::modelNameOffsets |
Byte offsets into model_filenames (MMID): a doodad placement's name_id indexes this list.
Definition at line 200 of file adt.hpp.
Referenced by validate().
| std::uint32_t wowlib::formats::adt::detail::ADT< V >::mver = AdtVersion18 |
| StringBlock wowlib::formats::adt::detail::ADT< V >::textures |
The tileset texture filenames (MTEX): the paths MapChunk layers index.
Present unless the tile uses MDID/MHID FileDataIDs (8.1+ height-texturing maps).
Definition at line 192 of file adt.hpp.
Referenced by validate().
|
staticconstexpr |
| StringBlock wowlib::formats::adt::detail::ADT< V >::wmoFilenames |
| std::vector<std::uint32_t> wowlib::formats::adt::detail::ADT< V >::wmoNameOffsets |
Byte offsets into wmo_filenames (MWID): a WMO placement's name_id indexes this list.
Definition at line 208 of file adt.hpp.
Referenced by validate().
| std::vector<common::SMMapObjDef> wowlib::formats::adt::detail::ADT< V >::wmoPlacements |
WMO placements on this tile (MODF).
Definition at line 216 of file adt.hpp.
Referenced by validate().