wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
scene.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <cstdint>
8
9#include <welder/vocabulary.hpp>
10
11#include <wowlib/core/lang.hpp>
15
21 struct [[
22 =welder::weld,
23 =welder::weld_as("M2Attachment"),
25 =welder::doc(R"(
26 One attachment point. Abstract over the client version; construct a concrete
27 version with M2Attachment.ForVersion / for_version.)")
29 // The concretes default operator== — the base must be comparable too.
30 bool operator==(const M2AttachmentBase&) const = default;
31 };
32
33 /** The version-agnostic base of every M2Event<V> (welded as "M2Event").
34 Bindings-only, like every *Base: it gives the per-version classes a
35 common welded supertype, so the family surface hoists their shared
36 members and containers of them carry a base-typed live view. */
37 struct [[
38 =welder::weld,
39 =welder::weld_as("M2Event"),
41 =welder::doc(R"(
42 One timed event. Abstract over the client version; construct a concrete
43 version with M2Event.ForVersion / for_version.)")
44 ]] M2EventBase {
45 // The concretes default operator== — the base must be comparable too.
46 bool operator==(const M2EventBase&) const = default;
47 };
48
52
53 struct [[
54 =welder::weld,
55 =welder::weld_as("M2Light"),
57 =welder::doc(R"(
58 One placed light. Abstract over the client version; construct a concrete
59 version with M2Light.ForVersion / for_version.)")
60 ]] M2LightBase {
61 // The concretes default operator== — the base must be comparable too.
62 bool operator==(const M2LightBase&) const = default;
63 };
64
69 struct [[
70 =welder::weld,
71 =welder::weld_as("M2Camera"),
73 =welder::doc(R"(
74 One model camera. Abstract over the client version; construct a concrete
75 version with M2Camera.ForVersion / for_version.)")
77 // The concretes default operator== — the base must be comparable too.
78 bool operator==(const M2CameraBase&) const = default;
79 };
81 namespace detail {
82 // The annotated era layouts; instantiate through the canonicalizing
83 // aliases below, never directly.
84 template <ClientVersion V>
85 struct [[
86 =welder::weld,
87 =welder::doc(
88 "An attachment point (weapons, effects, name plates), relative to a "
89 "bone.")
91 [[=welder::doc("Attachment slot (see wowdev's attachment id table).")]]
92 std::uint32_t id = 0;
93 [[=welder::doc("The bone the point follows.")]]
94 std::uint16_t bone = 0;
95 [[=welder::doc("Unknown; almost always 0 (vanilla's BogBeast.m2 carries "
96 "values here).")]]
97 std::uint16_t unknown = 0;
98 [[=welder::doc("Relative to the bone, typically its pivot.")]]
100 [[=welder::doc("Bool track: animate the attached model.")]]
101 record::M2Track<std::uint8_t, V> animateAttached{};
102
103 bool operator==(const M2Attachment&) const = default;
104 };
105
106 template <ClientVersion V>
107 struct [[
108 =welder::weld,
109 =welder::doc(
110 "A timed event ($DTH death thud, footsteps, sounds); every "
111 "enabled-track key fires.")
113 [[=welder::doc("Usually a '$xxx' four-char tag stored raw.")]]
114 std::uint32_t identifier = 0;
115 [[=welder::doc("Payload passed on fire (sound entry id, ...).")]]
116 std::uint32_t data = 0;
117 [[=welder::doc("The bone the event hangs off.")]]
118 std::uint32_t bone = 0;
119 [[=welder::doc("Relative to the bone.")]]
121 [[=welder::doc("Timestamp-only track: each key fires the event.")]]
123
124 bool operator==(const M2Event&) const = default;
125 };
127 template <ClientVersion V>
128 struct [[
129 =welder::weld,
130 =welder::doc(
131 "A model light: type 0 directional (login screens only), 1 point.")
132 ]] M2Light : M2LightBase {
133 [[=welder::doc("0 directional, 1 point.")]]
134 std::uint16_t type = 1;
135 [[=welder::doc("Bone to attach to, -1 for none.")]]
136 std::int16_t bone = -1;
137 [[=welder::doc("Relative to the bone, if any.")]]
138 C3Vector position{};
139 [[=welder::doc("RGB ambient color (no alpha).")]]
141 [[=welder::doc("Multiplies the ambient color; defaults to 1.0.")]]
142 record::M2Track<float, V> ambientIntensity{};
143 [[=welder::doc("RGB diffuse color (no alpha).")]]
144 record::M2Track<C3Vector, V> diffuseColor{};
145 [[=welder::doc("Multiplies the diffuse color; defaults to 1.0.")]]
146 record::M2Track<float, V> diffuseIntensity{};
147 [[=welder::doc("Distance where attenuation begins.")]]
148 record::M2Track<float, V> attenuationStart{};
149 [[=welder::doc("Distance where the light fades out entirely.")]]
150 record::M2Track<float, V> attenuationEnd{};
151 [[=welder::doc("Bool track: the light is enabled.")]]
153
154 bool operator==(const M2Light&) const = default;
155 };
156
157 template <ClientVersion V>
158 struct M2Camera;
159
160 template <ClientVersion V> requires (V < M2MultitexParticles)
161 struct [[
162 =welder::weld,
163 =welder::doc("A camera, pre-Cata layout: a static diagonal FOV plus "
164 "position/target/roll spline tracks.")
165 ]] M2Camera<V> : M2CameraBase {
166 [[=welder::doc("0 portrait, 1 character info, -1 flyby.")]]
167 std::uint32_t type = 0;
168 [[=welder::doc("Diagonal field of view, radians.")]]
169 float fov = 0;
170 [[=welder::doc("Far clip distance.")]]
171 float farClip = 0;
172 [[=welder::doc("Near clip distance.")]]
173 float nearClip = 0;
174 [[=welder::doc("Spline track moving the camera, one spline per segment.")]
175 ]
177 [[=welder::doc("Pivot point the position splines are relative to.")]]
178 C3Vector positionBase{};
179 [[=welder::doc("Spline track moving the look-at target, one spline per "
180 "segment.")]]
181 record::M2Track<M2SplineKey<C3Vector>, V> targetPosition{};
182 [[=welder::doc("Pivot point the target splines are relative to.")]]
183 C3Vector targetPositionBase{};
184 [[=welder::doc("0 .. 2*pi.")]]
186
187 bool operator==(const M2Camera&) const = default;
188 };
189
190 template <ClientVersion V>
191 requires (V >= M2MultitexParticles)
192 struct [[
193 =welder::weld,
194 =welder::doc(
195 "A camera (Cata+): the FOV becomes a spline track at the record tail.")
197 [[=welder::doc("0 portrait, 1 character info, -1 flyby.")]]
198 std::uint32_t type = 0;
199 [[=welder::doc("Far clip distance.")]]
200 float farClip = 0;
201 [[=welder::doc("Near clip distance.")]]
202 float nearClip = 0;
203 [[=welder::doc("Spline track moving the camera, one spline per segment.")]
206 [[=welder::doc("Pivot point the position splines are relative to.")]]
207 C3Vector positionBase{};
208 [[=welder::doc("Spline track moving the look-at target, one spline per "
209 "segment.")]]
210 record::M2Track<M2SplineKey<C3Vector>, V> targetPosition{};
211 [[=welder::doc("Pivot point the target splines are relative to.")]]
212 C3Vector targetPositionBase{};
213 [[=welder::doc("0 .. 2*pi.")]]
215 [[=welder::doc("Diagonal field of view, radians.")]]
217
218 bool operator==(const M2Camera&) const = default;
219 };
220 }
221
222 // The canonicalizing faces. Attachments, events and lights vary only with
223 // the embedded track era (M2TrackPivots); the camera also trades its
224 // static FoV for a spline track at Cata (M2CameraPivots).
225 template <ClientVersion V>
226 using M2Attachment =
228 template <ClientVersion V>
231 template <ClientVersion V>
234 template <ClientVersion V>
235 using M2Camera =
237}
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
Binding-language identities welder's core does not name.
#define WOWLIB_CS_FAMILY_SURFACE
The C# rod's family-surface opt-in, spellable in every build.
Definition lang.hpp:44
The M2 version vocabulary: the layout pivots record/entity partial specializations key on,...
The .bone facial-pose file entity (WoD+).
Definition bone.hpp:17
M2 body record structs (sequences, bones, tracks, textures, cameras, emitters) and their flag enums.
Definition bone.hpp:17
detail::M2TrackBase< canonicalVersion(V, M2TrackPivots, M2Versions)> M2TrackBase
A timestamp-only event track — the canonicalizing face of detail::M2TrackBase (same two eras and pivo...
Definition track.hpp:504
detail::M2Camera< canonicalVersion(V, M2CameraPivots, M2Versions)> M2Camera
Definition scene.hpp:204
detail::M2Track< T, canonicalVersion(V, M2TrackPivots, M2Versions)> M2Track
An animation track for value type T — the canonicalizing face of detail::M2Track: every client versio...
Definition track.hpp:498
detail::M2Light< canonicalVersion( V, M2TrackPivots, M2Versions)> M2Light
Definition scene.hpp:201
detail::M2Attachment< canonicalVersion(V, M2TrackPivots, M2Versions)> M2Attachment
Definition scene.hpp:195
detail::M2Event< canonicalVersion( V, M2TrackPivots, M2Versions)> M2Event
Definition scene.hpp:198
constexpr std::array M2TrackPivots
Track-shaped records (M2Track, M2TrackBase, and every record whose only version axis is the tracks it...
constexpr std::array M2CameraPivots
M2Camera: per-sequence tracks at WotLK, static FoV→spline at Cata.
constexpr ClientVersion M2MultitexParticles
cata (v272): particles turn multi-textured (492-byte record: texture id bitfield, multiTexScale repla...
constexpr std::array M2Versions
The versions M2 is instantiated (and welded) for: every targeted last-minor-of-major release,...
constexpr ClientVersion canonicalVersion(ClientVersion v, std::span< const ClientVersion > pivots, std::span< const ClientVersion > grid)
The canonical version v collapses to: the FIRST grid version in v's range.
A 3D float vector — the workhorse: positions, normals, rotations-as-Euler-degrees in placements.
Definition types.hpp:49
The version-agnostic base of every M2Attachment<V> (welded as "M2Attachment").
Definition scene.hpp:24
bool operator==(const M2AttachmentBase &) const =default
The version-agnostic base of every M2Camera<V> (welded as "M2Camera").
Definition scene.hpp:60
bool operator==(const M2CameraBase &) const =default
The version-agnostic base of every M2Event<V> (welded as "M2Event").
Definition scene.hpp:36
bool operator==(const M2EventBase &) const =default
The version-agnostic base of every M2Light<V> (welded as "M2Light").
Definition scene.hpp:48
bool operator==(const M2LightBase &) const =default
An attachment point (weapons, effects, name plates), relative to a bone.
Definition scene.hpp:70
bool operator==(const M2Attachment &) const =default
std::uint32_t type
0 portrait, 1 character info, -1 flyby.
Definition scene.hpp:136
float fov
Diagonal field of view, radians.
Definition scene.hpp:138
A timed event ($DTH death thud, footsteps, sounds); every enabled-track key fires.
Definition scene.hpp:87
bool operator==(const M2Event &) const =default
A model light: type 0 directional (login screens only), 1 point.
Definition scene.hpp:104
bool operator==(const M2Light &) const =default
The M2 animation vocabulary (namespace wowlib::formats::m2::root::record): the small fixed-size primi...