wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
records.hpp
Go to the documentation of this file.
1#pragma once
2
8
9#include <array>
10#include <cstdint>
11#include <vector>
12
13#include <welder/vocabulary.hpp>
14
18
21 struct [[
22 =welder::weld,
23 =welder::doc("An AFID entry: the .anim FileDataID for one (animation, "
24 "variation) pair; 0 means none.")
25 ]] AnimFileEntry {
26 [[=welder::doc("AnimationData.dbc id of the sequence.")]]
27 std::uint16_t animId = 0;
28 [[=welder::doc("The sequence variation index.")]]
29 std::uint16_t subAnimId = 0;
30 [[=welder::doc("FileDataID of the .anim file; 0 means none.")]]
31 std::uint32_t fileId = 0;
32
33 bool operator==(const AnimFileEntry&) const = default;
34 };
35
36 static_assert(sizeof(AnimFileEntry) == 8);
37
38 /** One EXPT record: the pre-EXP2 extended particle parameters (the client
39 reconstructs EXP2 from these when EXP2 is absent). */
40 struct [[
41 =welder::weld,
42 =welder::doc("An EXPT record: z-source, color and alpha multipliers for "
43 "one particle emitter.")
45 [[=welder::doc("If > 0, initial velocity points from (0, 0, z_source) to "
46 "the spawn point.")]]
47 float zSource = 0;
48 [[=welder::doc("Multiplied into the particle's diffuse color.")]]
49 float colorMult = 1;
50 [[=welder::doc("Multiplied into the particle's opacity.")]]
51 float alphaMult = 1;
53 bool operator==(const M2ExtendedParticleSimple&) const = default;
54 };
55
56 static_assert(sizeof(M2ExtendedParticleSimple) == 12);
57
58 struct [[
59 =welder::weld,
60 =welder::doc("An EXP2 record: the EXPT parameters plus the per-lifetime "
61 "alpha-cutoff ramp.")
63 [[=welder::doc("If > 0, initial velocity points from (0, 0, z_source) to "
64 "the spawn point.")]]
65 float zSource = 0;
66 [[=welder::doc("Multiplied into the particle's diffuse color.")]]
67 float colorMult = 1;
68 [[=welder::doc("Multiplied into the particle's opacity.")]]
69 float alphaMult = 1;
70 [[=welder::doc("Alpha-test threshold sampled by the particle's lifetime.")]]
73 bool operator==(const M2ExtendedParticle&) const = default;
74 };
75
78 struct [[
79 =welder::weld,
80 =welder::doc("A DETL record (9.0+): per-light flags, shadow-RT scale and "
81 "diffuse multiplier (raw half-floats).")
82 ]] M2LightDetail {
83 [[=welder::doc("Unknown per-light flags.")]]
84 std::uint16_t flags = 0;
85 [[=welder::doc("Scale for the shadow RT matrix (raw half-float).")]]
86 std::uint16_t scaleHalf = 0;
87 [[=welder::doc("Multiplier for the light's diffuse color (raw "
88 "half-float).")]]
89 std::uint16_t diffuseColorMultHalf = 0;
90 [[=welder::doc("Unknown.")]]
91 std::uint16_t unknown0 = 0;
92 [[=welder::doc("Unknown.")]]
93 std::uint32_t unknown1 = 0;
95 bool operator==(const M2LightDetail&) const = default;
96 };
97
98 static_assert(sizeof(M2LightDetail) == 12);
99
100 // The chunk payloads are NON-templated: their content is version-independent
101 // (M2ExtendedParticle's alphaCutoff is the unversioned M2PartTrack, PSBC
102 // holds unversioned M2Bounds, the rest are plain int arrays) and the chunks
103 // only exist Legion+, so any embedded offset structure is fixed at its WotLK+
104 // layout. Rather than propagate the shell's V through a type that never uses
105 // it, they fix `version` at versions::legion — one welded class per payload,
106 // no per-shell-version instantiation.
107
108 struct [[
109 =welder::weld,
110 =welder::doc("The EXP2 chunk payload: extended particle records, one per "
111 "particle emitter.")
113 static constexpr ClientVersion Version = versions::Legion;
114
115 [[=welder::mark::no_reassign,
116 =welder::doc("Extended particle parameters, one per particle emitter.")]]
117 std::vector<M2ExtendedParticle> content;
120
121 [[=welder::mark::exclude]]
122 bool empty() const { return content.empty(); }
124 bool operator==(const Exp2Data&) const = default;
125 };
127 struct [[
128 =welder::weld,
129 =welder::doc("The PABC chunk payload: the parent-model sequence-id "
130 "blacklist ('BlacklistAnimData').")
133
134 [[=welder::mark::no_reassign,
135 =welder::doc("Replacement parent-sequence lookups: a plain list of "
136 "present AnimationData ids.")]]
137 std::vector<std::uint16_t> replacementParentSequenceLookups;
138
141 [[=welder::mark::exclude]]
142 bool empty() const { return replacementParentSequenceLookups.empty(); }
143
144 bool operator==(const PabcData&) const = default;
145 };
147 struct [[
148 =welder::weld,
149 =welder::doc("The PSBC chunk payload: parent sequence bounds.")
151 static constexpr ClientVersion Version = versions::Legion;
152
153 [[=welder::mark::no_reassign,
154 =welder::doc("Parent sequence bounds, one per parent sequence.")]]
155 std::vector<root::record::M2Bounds> parentSequenceBounds;
156
159 [[=welder::mark::exclude]]
160 bool empty() const { return parentSequenceBounds.empty(); }
161
162 bool operator==(const PsbcData&) const = default;
163 };
164
165 struct [[
166 =welder::weld,
167 =welder::doc("The PGD1 chunk payload: per-particle-emitter geoset "
168 "assignments.")
170 static constexpr ClientVersion Version = versions::Legion;
171
172 [[=welder::mark::no_reassign,
173 =welder::doc("The geoset each particle emitter obeys (M2SkinSection "
174 "geoset rules).")]]
175 std::vector<std::uint16_t> geosets;
176
179 [[=welder::mark::exclude]]
180 bool empty() const { return geosets.empty(); }
181
182 bool operator==(const Pgd1Data&) const = default;
183 };
184}
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
Companion-chunk payload records of the chunked .m2 shell.
Definition records.hpp:19
constexpr ClientVersion Legion
The offset-format storage vocabulary and serializer engine for the M2 family, in one header.
The serialization face of an offset block, mixed in CRTP-style: an entity struct E : M2OffsetBlock<E>...
One AFID entry: which FileDataID serves a sequence's .anim data.
Definition records.hpp:22
std::uint16_t subAnimId
The sequence variation index.
Definition records.hpp:26
bool operator==(const AnimFileEntry &) const =default
std::uint16_t animId
AnimationData.dbc id of the sequence.
Definition records.hpp:24
std::uint32_t fileId
FileDataID of the .anim file; 0 means none.
Definition records.hpp:28
The EXP2 chunk payload: extended particle records, one per particle emitter.
Definition records.hpp:94
std::vector< M2ExtendedParticle > content
Extended particle parameters, one per particle emitter.
Definition records.hpp:98
static constexpr ClientVersion Version
Definition records.hpp:95
bool empty() const
Chunk engagement: shadow M2OffsetBlock's always-false empty() so the optional chunk is emitted only w...
Definition records.hpp:102
bool operator==(const Exp2Data &) const =default
One EXPT record: the pre-EXP2 extended particle parameters (the client reconstructs EXP2 from these w...
Definition records.hpp:38
float colorMult
Multiplied into the particle's diffuse color.
Definition records.hpp:42
bool operator==(const M2ExtendedParticleSimple &) const =default
float alphaMult
Multiplied into the particle's opacity.
Definition records.hpp:44
float zSource
If > 0, initial velocity points from (0, 0, z_source) to the spawn point.
Definition records.hpp:40
An EXP2 record: the EXPT parameters plus the per-lifetime alpha-cutoff ramp.
Definition records.hpp:52
root::record::M2PartTrack< fixed16 > alphaCutoff
Alpha-test threshold sampled by the particle's lifetime.
Definition records.hpp:60
float alphaMult
Multiplied into the particle's opacity.
Definition records.hpp:58
float colorMult
Multiplied into the particle's diffuse color.
Definition records.hpp:56
bool operator==(const M2ExtendedParticle &) const =default
float zSource
If > 0, initial velocity points from (0, 0, z_source) to the spawn point.
Definition records.hpp:54
One DETL record: per-light shadow/diffuse overrides (9.0+); the halves are raw IEEE half-floats.
Definition records.hpp:68
std::uint16_t flags
Unknown per-light flags.
Definition records.hpp:70
bool operator==(const M2LightDetail &) const =default
std::uint16_t scaleHalf
Scale for the shadow RT matrix (raw half-float).
Definition records.hpp:72
std::uint16_t diffuseColorMultHalf
Multiplier for the light's diffuse color (raw half-float).
Definition records.hpp:74
The PABC chunk payload: the parent-model sequence-id blacklist ('BlacklistAnimData').
Definition records.hpp:108
std::vector< std::uint16_t > replacementParentSequenceLookups
Replacement parent-sequence lookups: a plain list of present AnimationData ids.
Definition records.hpp:112
static constexpr ClientVersion Version
Definition records.hpp:109
bool empty() const
Chunk engagement: shadow M2OffsetBlock's always-false empty() so the optional chunk is emitted only w...
Definition records.hpp:116
bool operator==(const PabcData &) const =default
The PGD1 chunk payload: per-particle-emitter geoset assignments.
Definition records.hpp:136
std::vector< std::uint16_t > geosets
The geoset each particle emitter obeys (M2SkinSection geoset rules).
Definition records.hpp:140
bool operator==(const Pgd1Data &) const =default
bool empty() const
Chunk engagement: shadow M2OffsetBlock's always-false empty() so the optional chunk is emitted only w...
Definition records.hpp:144
static constexpr ClientVersion Version
Definition records.hpp:137
The PSBC chunk payload: parent sequence bounds.
Definition records.hpp:122
std::vector< root::record::M2Bounds > parentSequenceBounds
Parent sequence bounds, one per parent sequence.
Definition records.hpp:126
bool operator==(const PsbcData &) const =default
static constexpr ClientVersion Version
Definition records.hpp:123
bool empty() const
Chunk engagement: shadow M2OffsetBlock's always-false empty() so the optional chunk is emitted only w...
Definition records.hpp:130
The M2 animation vocabulary (namespace wowlib::formats::m2::root::record): the small fixed-size primi...