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

A whole M2 model for one client version: the MD20 body plus every baked-in satellite. More...

#include <wowlib/formats/m2/m2.hpp>

Inheritance diagram for wowlib::formats::m2::detail::M2< V >:

Public Member Functions

Result< void > read (fs::FileSystem &fs, const FileKey &key)
 Load the model and all its satellite files from a client filesystem, replacing this entity's contents.
Result< void > write (fs::FileSystem &fs, const FileKey &key) const
 Serialize and store the model and every satellite file through the filesystem's project overlay; satellite 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().
bool operator== (const M2 &) const =default
Public Member Functions inherited from wowlib::formats::m2::M2Base
bool operator== (const M2Base &) const =default

Public Attributes

M2Root< V > root {}
 The MD20 body — the model's root, uniform across every era (pre-Legion it IS the file; Legion+ it is the decoded MD21 image, whose transport blob chunks drops after read).

Static Public Attributes

static constexpr ClientVersion Version = V

Detailed Description

template<ClientVersion V>
struct wowlib::formats::m2::detail::M2< V >

A whole M2 model for one client version: the MD20 body plus every baked-in satellite.

Reading resolves external sequence data (.anim) and the LOD views (.skin) into the entity; writing re-derives the satellite set — sequences with (flags & 0x130) == 0 split back into "{model}AAAA-SS.anim" files, the skins into "{model}0N.skin".

There is no byte-perfect round-trip for offset formats: writes lay data out canonically, and a written model re-reads equal instead. Instantiate through the canonicalizing m2::M2 alias, never directly.

Template Parameters
Vthe canonical client version this assembly targets.
See also
https://wowdev.wiki/M2

Definition at line 122 of file m2.hpp.

Member Function Documentation

◆ ensureValid()

template<ClientVersion V>
Result< void > wowlib::formats::m2::detail::M2< V >::ensureValid ( ) const
nodiscard

Validate and raise on the first error instead of returning a report — the assert-style face of validate().

Returns
nothing; raises when validate() finds any error

Definition at line 895 of file m2.hpp.

References wowlib::formats::m2::detail::M2< canonicalVersion(V, M2AssemblyPivots, M2Versions)>::ensureValid(), and validate().

◆ operator==()

template<ClientVersion V>
bool wowlib::formats::m2::detail::M2< V >::operator== ( const M2< V > & ) const
default

◆ read()

template<ClientVersion V>
Result< void > wowlib::formats::m2::detail::M2< V >::read ( fs::FileSystem & fs,
const FileKey & key )

Load the model and all its satellite files from a client filesystem, replacing this entity's contents.

Parameters
fsthe filesystem gateway
keythe .m2 file identity (path and/or FileDataID)

Definition at line 525 of file m2.hpp.

References wowlib::FormatVersionMismatch, wowlib::formats::m2::M2ChunkedContainer, wowlib::formats::m2::M2ChunkedOnly, wowlib::formats::m2::M2PerSequenceTimelines, wowlib::makeError(), wowlib::formats::m2::Md20Magic, wowlib::formats::m2::detail::M2< canonicalVersion(V, M2AssemblyPivots, M2Versions)>::read(), and root.

◆ validate()

◆ write()

template<ClientVersion V>
Result< void > wowlib::formats::m2::detail::M2< V >::write ( fs::FileSystem & fs,
const FileKey & key ) const

Serialize and store the model and every satellite file through the filesystem's project overlay; satellite names derive from the key, which must resolve to a path.

Parameters
fsthe filesystem gateway
keythe .m2 file identity; must resolve to a path

Definition at line 565 of file m2.hpp.

References wowlib::formats::m2::M2ChunkedContainer, wowlib::formats::m2::M2PerSequenceTimelines, wowlib::makeError(), wowlib::FileKey::path, wowlib::PathNotResolvable, root, and wowlib::formats::m2::detail::M2< canonicalVersion(V, M2AssemblyPivots, M2Versions)>::write().

Member Data Documentation

◆ root

The MD20 body — the model's root, uniform across every era (pre-Legion it IS the file; Legion+ it is the decoded MD21 image, whose transport blob chunks drops after read).

Definition at line 128 of file m2.hpp.

Referenced by read(), validate(), and write().

◆ Version

template<ClientVersion V>
ClientVersion wowlib::formats::m2::detail::M2< V >::Version = V
staticconstexpr

Definition at line 125 of file m2.hpp.


The documentation for this struct was generated from the following file:
  • src/wowlib/formats/m2/m2.hpp