wowlib
0.0.0
Read & write World of Warcraft client files — a C++26 core
Toggle main menu visibility
Loading...
Searching...
No Matches
header.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <algorithm>
7
#include <array>
8
#include <cstdint>
9
#include <string_view>
10
#include <utility>
11
12
#include <welder/vocabulary.hpp>
13
14
#include <
wowlib/formats/common/flags.hpp
>
15
#include <
wowlib/formats/common/types.hpp
>
16
17
namespace
wowlib::formats::wmo::root::chunks
{
18
// --- MOHD -------------------------------------------------------------------
19
20
enum class
[[
21
=welder::weld,
22
=welder::flags,
23
=welder::doc(
"Root header flag bits (SMOHeader.flags)."
)
24
]]
HeaderFlags
: std::uint16_t {
25
DoNotAttenuateVertices
[[=
26
welder::doc(
"Do not attenuate vertices based on portal distance."
)]] =
27
0x1,
28
UseUnifiedRenderPath
[[=
29
welder::doc(
"Attenuate on portal exit (unified render path)."
)]] = 0x2,
30
UseLiquidTypeDbcId
[[=
31
welder::doc(
"MLIQ ids are LiquidType foreign keys, not the legacy set."
)]]
32
= 0x4,
33
DoNotFixVertexColorAlpha
[[=
34
welder::doc(
"Skip the vertex-color alpha fixup (FixColorVertexAlpha)."
)]]
35
= 0x8,
36
Lod
[[=welder::doc(
"The WMO has LOD group files (Legion+)."
)]] = 0x10,
37
DefaultMaxLod
[[=welder::doc(
38
"num_lod is defaulted, implying 3 LOD levels (BfA+)."
)]] = 0x20
39
};
40
41
struct
[[
42
=welder::weld,
43
=welder::doc(
44
"The MOHD root header: entity counts, ambient color, bounds and "
45
"root-wide flags."
)
46
]]
SMOHeader
{
47
// Three of the seven counts are DERIVED binary fields: WMORoot::patchChunk
48
// stamps nGroups/nPortals/nDoodadSets from the owning tables on write
49
// and the bindings hide them — the containers are the single source of
50
// truth (surveyed across both test clients: every file agrees). The other
51
// four counts are NOT derivable — real client files store legacy values
52
// their containers do not reproduce — so they stay ordinary stored
53
// fields, preserved verbatim for the byte-perfect round-trip.
54
55
[[=welder::doc(
"Number of textures. NOT derived: hundreds of client files "
56
"store more than the MOTX entry count (exporter-era "
57
"duplicates), and 8.3+ FileDataID-era files keep a legacy "
58
"value with no MOTX at all; preserved as stored."
)]]
59
std::uint32_t
nTextures
= 0;
60
61
[[=welder::mark::exclude,
62
=welder::doc(
"Number of group files; derived from the MOGI group-info "
63
"table on write and hidden from bindings."
)]]
64
std::uint32_t
nGroups
= 0;
65
66
[[=welder::mark::exclude,
67
=welder::doc(
"Number of portals; derived from the MOPT table on write "
68
"and hidden from bindings."
)]]
69
std::uint32_t
nPortals
= 0;
70
71
[[=welder::doc(
"Number of lights (MOLT). NOT derived: a handful of 8.x "
72
"files store a different count (extra non-MOLT lights); "
73
"preserved as stored."
)]]
74
std::uint32_t
nLights
= 0;
75
76
[[=welder::doc(
"Number of doodad filenames. Matches the MODN entry count "
77
"pre-8.3, but FileDataID-era files keep a legacy value "
78
"unrelated to MODI's length; preserved as stored."
)]]
79
std::uint32_t
nDoodadNames
= 0;
80
81
[[=welder::doc(
"Number of doodad placements (MODD). NOT derived: many "
82
"client files store an inflated legacy count; preserved "
83
"as stored."
)]]
84
std::uint32_t
nDoodadDefs
= 0;
85
86
[[=welder::mark::exclude,
87
=welder::doc(
"Number of doodad sets; derived from the MODS table on "
88
"write and hidden from bindings."
)]]
89
std::uint32_t
nDoodadSets
= 0;
90
91
[[=welder::doc(
"Base ambient color."
)]]
92
CArgb
ambientColor
{};
93
94
[[=welder::doc(
"Foreign key into WMOAreaTable (m_WMOID)."
)]]
95
std::uint32_t wmoId = 0;
96
97
[[=welder::doc(
"Bounding box of the whole object in model space."
)]]
98
CAaBox
boundingBox{};
99
100
[[=welder::doc(
"Root-wide flags; HeaderFlags bits."
)]]
101
HeaderFlags
flags{};
102
103
[[=welder::doc(
104
"Number of LOD levels including the base (Legion+; zero before)."
)]]
105
std::uint16_t numLod = 0;
106
};
107
108
static_assert
(
sizeof
(SMOHeader) == 0x40);
109
}
flags.hpp
Flag-testing convenience for the binary formats' bit-mask enums.
wowlib::formats::wmo::root::chunks
WMO root-file chunk binary structs (MOHD, MOMT, lights, doodads, fog, ambient volumes) and their flag...
Definition
doodad.hpp:17
wowlib::formats::wmo::root::chunks::HeaderFlags
HeaderFlags
Root header flag bits (SMOHeader.flags).
Definition
header.hpp:21
wowlib::formats::wmo::root::chunks::HeaderFlags::DoNotAttenuateVertices
@ DoNotAttenuateVertices
Do not attenuate vertices based on portal distance.
Definition
header.hpp:22
wowlib::formats::wmo::root::chunks::HeaderFlags::UseUnifiedRenderPath
@ UseUnifiedRenderPath
Attenuate on portal exit (unified render path).
Definition
header.hpp:24
wowlib::formats::wmo::root::chunks::HeaderFlags::Lod
@ Lod
The WMO has LOD group files (Legion+).
Definition
header.hpp:29
wowlib::formats::wmo::root::chunks::HeaderFlags::DoNotFixVertexColorAlpha
@ DoNotFixVertexColorAlpha
Skip the vertex-color alpha fixup (FixColorVertexAlpha).
Definition
header.hpp:27
wowlib::formats::wmo::root::chunks::HeaderFlags::DefaultMaxLod
@ DefaultMaxLod
num_lod is defaulted, implying 3 LOD levels (BfA+).
Definition
header.hpp:30
wowlib::formats::wmo::root::chunks::HeaderFlags::UseLiquidTypeDbcId
@ UseLiquidTypeDbcId
MLIQ ids are LiquidType foreign keys, not the legacy set.
Definition
header.hpp:25
wowlib::formats::common::CAaBox
An axis-aligned bounding box: minimum and maximum corners.
Definition
types.hpp:134
wowlib::formats::common::CArgb
A color stored as r, g, b, a bytes.
Definition
types.hpp:164
wowlib::formats::wmo::root::chunks::SMOHeader
The MOHD root header: entity counts, ambient color, bounds and root-wide flags.
Definition
header.hpp:34
wowlib::formats::wmo::root::chunks::SMOHeader::ambientColor
CArgb ambientColor
Base ambient color.
Definition
header.hpp:65
wowlib::formats::wmo::root::chunks::SMOHeader::nTextures
std::uint32_t nTextures
Number of textures.
Definition
header.hpp:44
wowlib::formats::wmo::root::chunks::SMOHeader::nDoodadDefs
std::uint32_t nDoodadDefs
Number of doodad placements (MODD).
Definition
header.hpp:59
wowlib::formats::wmo::root::chunks::SMOHeader::flags
HeaderFlags flags
Root-wide flags; HeaderFlags bits.
Definition
header.hpp:74
wowlib::formats::wmo::root::chunks::SMOHeader::nDoodadNames
std::uint32_t nDoodadNames
Number of doodad filenames.
Definition
header.hpp:56
wowlib::formats::wmo::root::chunks::SMOHeader::numLod
std::uint16_t numLod
Number of LOD levels including the base (Legion+; zero before).
Definition
header.hpp:77
wowlib::formats::wmo::root::chunks::SMOHeader::nDoodadSets
std::uint32_t nDoodadSets
Number of doodad sets; derived from the MODS table on write and hidden from bindings.
Definition
header.hpp:62
wowlib::formats::wmo::root::chunks::SMOHeader::nGroups
std::uint32_t nGroups
Number of group files; derived from the MOGI group-info table on write and hidden from bindings.
Definition
header.hpp:47
wowlib::formats::wmo::root::chunks::SMOHeader::nPortals
std::uint32_t nPortals
Number of portals; derived from the MOPT table on write and hidden from bindings.
Definition
header.hpp:50
wowlib::formats::wmo::root::chunks::SMOHeader::wmoId
std::uint32_t wmoId
Foreign key into WMOAreaTable (m_WMOID).
Definition
header.hpp:68
wowlib::formats::wmo::root::chunks::SMOHeader::nLights
std::uint32_t nLights
Number of lights (MOLT).
Definition
header.hpp:53
wowlib::formats::wmo::root::chunks::SMOHeader::boundingBox
CAaBox boundingBox
Bounding box of the whole object in model space.
Definition
header.hpp:71
types.hpp
The binary-level math and color primitives shared across WoW file formats (wowdev....
src
wowlib
formats
wmo
root
chunks
header.hpp
Generated by
1.17.0