wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::wmo::root::detail::WMORoot< V > Struct Template Reference

A WMO (world map object) root file for one client version. More...

#include <wowlib/formats/wmo/root/root.hpp>

Inheritance diagram for wowlib::formats::wmo::root::detail::WMORoot< V >:

Public Member Functions

void patchChunk (std::uint32_t fourccMagic, std::span< std::byte > payload) const
 Serializer hook (see writeEntity): stamp the derived MOHD counts into the just-written header payload — nGroups from the MOGI table, nPortals and nDoodadSets from their vectors.
void validateExtra (ValidationReport &report) const
 Validation hook (see detail::validateEntity): the root contracts the annotations cannot express — doodad-set/portal/visible-block ranges, string-block references and the doodad name/FileDataID resolution.
Public Member Functions inherited from wowlib::formats::ChunkedFile< WMORoot< V > >
Result< void > read (std::span< const std::byte > data)
 Deserialize file bytes into this entity, replacing its contents.
Result< FileBuffer > write () const
 Serialize this entity.
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().
bool operator== (const ChunkedFile &) const=default
Public Member Functions inherited from wowlib::formats::ChunkExtras
bool operator== (const ChunkExtras &) const =default

Public Attributes

std::uint32_t mver = WmoVersionV17
 The WMO format version; 17 for every supported client.
SMOHeader header {}
 The root header (MOHD).
std::vector< SMOMaterial > materials
 Materials (MOMT).
StringBlock groupNames
 Group names (MOGN), referenced by byte offset.
std::vector< SMOGroupInfo > groupInfos
 Per-group info (MOGI).
ChunkBlob skyboxName
std::vector< C3Vector > portalVertices
 Portal vertices (MOPV).
std::vector< SMOPortal > portals
 Portals (MOPT).
std::vector< SMOPortalRef > portalRefs
 Portal references from groups (MOPR).
std::vector< C3Vector > visibleBlockVertices
 Visible block vertices (MOVV).
std::vector< SMOVisibleBlock > visibleBlocks
 Visible blocks (MOVB).
std::vector< SMOLight > lights
 Lights (MOLT).
std::vector< SMODoodadSet > doodadSets
 Doodad sets (MODS).
std::vector< SMODoodadDef > doodadDefs
 Doodad placements (MODD).
std::vector< SMOFog > fogs
 Fog volumes (MFOG).
std::vector< C4Plane > convexVolumePlanes
 Convex volume planes (MCVP); transports mostly.
ChunkBlob momx
 MOMX (11.x, undocumented purpose); preserved opaque.
Public Attributes inherited from wowlib::formats::ChunkExtras
std::vector< JournalEntry > journal
std::vector< UnknownChunk > unknown
std::vector< std::byte > trailing

Static Public Attributes

static constexpr ClientVersion Version = V
static constexpr std::array ChunkOrder
 The canonical chunk-stream order the serializer emits a fresh entity in — decoupled from the by-trait flatten order of the version bases.

Detailed Description

template<ClientVersion V>
struct wowlib::formats::wmo::root::detail::WMORoot< V >

A WMO (world map object) root file for one client version.

The root file holds everything shared across the object — the material and texture tables, doodad (M2) sets and placements, portals, lights, fog, the convex-volume/visible-block culling data and the per-group table (MOGI/GFID) — while the actual 3D geometry lives in the separate group files (WMOGroup). The always-present chunks are own members (canonical order); version-gated chunks are inherited from the detail:: trait bases active for V.

Template Parameters
Vthe client version this layout targets.
See also
https://wowdev.wiki/WMO

Definition at line 172 of file root.hpp.

Member Function Documentation

◆ patchChunk()

template<ClientVersion V>
void wowlib::formats::wmo::root::detail::WMORoot< V >::patchChunk ( std::uint32_t fourccMagic,
std::span< std::byte > payload ) const
inline

Serializer hook (see writeEntity): stamp the derived MOHD counts into the just-written header payload — nGroups from the MOGI table, nPortals and nDoodadSets from their vectors.

The counts real client files disagree with their containers on (nTextures, nLights, nDoodadDefs, nDoodadNames) stay stored fields; see SMOHeader.

Parameters
fourccMagicthe emitted chunk's id, in disk layout.
payloadthe finished chunk payload, patched in place.

Definition at line 304 of file root.hpp.

◆ validateExtra()

template<ClientVersion V>
void wowlib::formats::wmo::root::detail::WMORoot< V >::validateExtra ( ValidationReport & report) const
inline

Validation hook (see detail::validateEntity): the root contracts the annotations cannot express — doodad-set/portal/visible-block ranges, string-block references and the doodad name/FileDataID resolution.

The MOHD counts patchChunk derives (nGroups, nPortals, nDoodadSets) need no check — every write restamps them — and the counts real files ship stale (nTextures, nLights, nDoodadDefs, nDoodadNames; see SMOHeader) are deliberately not validated. Cross-entity contracts (MOGI vs the group files, group references into this root) are the assembly's validate().

Parameters
reportthe report findings land in.

Definition at line 324 of file root.hpp.

Member Data Documentation

◆ ChunkOrder

template<ClientVersion V>
std::array wowlib::formats::wmo::root::detail::WMORoot< V >::ChunkOrder
staticconstexpr

The canonical chunk-stream order the serializer emits a fresh entity in — decoupled from the by-trait flatten order of the version bases.

Lists every chunk member exactly once (checked at compile time by writeOrder).

MFOB (12.1+, Midnight) postdates the supported client range; it and any other unmodeled root chunk round-trip through ChunkExtras::unknown.

Definition at line 259 of file root.hpp.

◆ convexVolumePlanes

template<ClientVersion V>
std::vector<C4Plane> wowlib::formats::wmo::root::detail::WMORoot< V >::convexVolumePlanes

Convex volume planes (MCVP); transports mostly.

Definition at line 247 of file root.hpp.

◆ doodadDefs

template<ClientVersion V>
std::vector<SMODoodadDef> wowlib::formats::wmo::root::detail::WMORoot< V >::doodadDefs

Doodad placements (MODD).

Definition at line 239 of file root.hpp.

◆ doodadSets

template<ClientVersion V>
std::vector<SMODoodadSet> wowlib::formats::wmo::root::detail::WMORoot< V >::doodadSets

Doodad sets (MODS).

Definition at line 235 of file root.hpp.

◆ fogs

Fog volumes (MFOG).

Definition at line 243 of file root.hpp.

◆ groupInfos

template<ClientVersion V>
std::vector<SMOGroupInfo> wowlib::formats::wmo::root::detail::WMORoot< V >::groupInfos

Per-group info (MOGI).

Definition at line 204 of file root.hpp.

◆ groupNames

Group names (MOGN), referenced by byte offset.

Definition at line 200 of file root.hpp.

◆ header

The root header (MOHD).

Definition at line 192 of file root.hpp.

◆ lights

Lights (MOLT).

Definition at line 231 of file root.hpp.

◆ materials

template<ClientVersion V>
std::vector<SMOMaterial> wowlib::formats::wmo::root::detail::WMORoot< V >::materials

Materials (MOMT).

Definition at line 196 of file root.hpp.

◆ momx

MOMX (11.x, undocumented purpose); preserved opaque.

Definition at line 251 of file root.hpp.

◆ mver

The WMO format version; 17 for every supported client.

Definition at line 188 of file root.hpp.

◆ portalRefs

template<ClientVersion V>
std::vector<SMOPortalRef> wowlib::formats::wmo::root::detail::WMORoot< V >::portalRefs

Portal references from groups (MOPR).

Definition at line 219 of file root.hpp.

◆ portals

Portals (MOPT).

Definition at line 215 of file root.hpp.

◆ portalVertices

template<ClientVersion V>
std::vector<C3Vector> wowlib::formats::wmo::root::detail::WMORoot< V >::portalVertices

Portal vertices (MOPV).

Definition at line 211 of file root.hpp.

◆ skyboxName

Definition at line 207 of file root.hpp.

◆ Version

template<ClientVersion V>
ClientVersion wowlib::formats::wmo::root::detail::WMORoot< V >::Version = V
staticconstexpr

Definition at line 184 of file root.hpp.

◆ visibleBlocks

template<ClientVersion V>
std::vector<SMOVisibleBlock> wowlib::formats::wmo::root::detail::WMORoot< V >::visibleBlocks

Visible blocks (MOVB).

Definition at line 227 of file root.hpp.

◆ visibleBlockVertices

template<ClientVersion V>
std::vector<C3Vector> wowlib::formats::wmo::root::detail::WMORoot< V >::visibleBlockVertices

Visible block vertices (MOVV).

Definition at line 223 of file root.hpp.


The documentation for this struct was generated from the following file: