wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
lights.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#include <cstdint>
9#include <vector>
10
13#include <wowlib/core/lang.hpp>
19
21 using namespace wowlib::formats::wdt::lights::chunks;
22
26 struct [[
27 =welder::weld,
28 =welder::weld_as("WDTLights"),
30 =welder::doc(R"(
31 A _lgt.wdt lights satellite (WoD+), abstract over the client version:
32 the map's freely placed point and spot lights. Construct a concrete
33 version with WDTLights.for_version(expansion). See
34 https://wowdev.wiki/WDT.)")
35 ]] WDTLightsBase {};
36
37 namespace detail {
38 // --- version-range trait bases (unwelded) ---------------------------------
43 struct LightsWod {
44 [[
45 =chunk("MPLT"),
49 =welder::mark::no_reassign,
50 =welder::doc(
51 "The WoD point lights (MPLT); Legion+ clients ignore them in "
52 "favor of MPL2.")]]
53 std::vector<MapPointLightLegacy> legacyPointLights;
54 };
55
57 struct LightsLegion {
58 [[
59 =chunk("MPL2"),
62 =welder::mark::no_reassign,
63 =welder::doc("The Legion point lights (MPL2); 9.0+ files carry MPL3 "
64 "instead.")]]
65 std::vector<MapPointLight> pointLights;
66
67 [[
68 =chunk("MSLT"),
71 =welder::mark::no_reassign,
72 =welder::doc("The spot lights (MSLT, Legion+).")]]
73 std::vector<MapSpotLight> spotLights;
74
75 [[
76 =chunk("MTEX"),
79 =welder::mark::no_reassign,
80 =welder::doc(
81 "Light-cookie texture FileDataIDs (MTEX, Legion+), referenced "
82 "by texture_index.")]]
83 std::vector<std::uint32_t> textureFdids;
84
85 [[
86 =chunk("MLTA"),
89 =welder::mark::no_reassign,
90 =welder::doc("Light texture animations (MLTA, Legion+), referenced by "
91 "mlta_index.")]]
92 std::vector<LightAnimation> lightAnimations;
93 };
96 struct LightsSL {
97 [[
98 =chunk("MPL3"),
101 =welder::mark::no_reassign,
102 =welder::doc(
103 "The Shadowlands point lights (MPL3, 9.0.1.34490+; replaces "
104 "MPL2 in shipped files).")]]
105 std::vector<MapPointLight3> pointLightsV3;
106 };
107 }
108
109 namespace detail {
116 template <ClientVersion V>
117 struct [[
118 =welder::weld,
119 =welder::doc(R"(
120 A _lgt.wdt lights satellite for one client version (WoD+): freely
121 placed point lights (MPLT/MPL2/MPL3 by era), spot lights, their
122 textures and animations. See https://wowdev.wiki/WDT.)")
123 ]] WDTLights
129 static constexpr ClientVersion Version = V;
130
131 [[
132 =chunk("MVER"),
133 =welder::doc("The file format version: 18 up to Legion 7.0.1.20740, 20 "
134 "since 7.0.1.20914.")]]
135 std::uint32_t mver = V >= builds::Legion_Alpha_20914 ? 20 : WdtVersion18;
136
139 static constexpr std::array ChunkOrder = {
140 fourcc("MVER"),
141 fourcc("MPLT"),
142 fourcc("MPL2"),
143 fourcc("MPL3"),
144 fourcc("MSLT"),
145 fourcc("MTEX"),
146 fourcc("MLTA"),
147 };
148 };
149 }
150
154 template <ClientVersion V> requires(V >= builds::WoD)
156}
The chunk framework, vocabulary and engine in one header.
Named ClientVersion constants for the exact client builds format features appeared (or vanished) at —...
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
FourCC chunk identifiers: compile-time conversion of the four-letter codes to the host integers chunk...
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
constexpr ClientVersion Legion
legion (any 7.x client).
constexpr ClientVersion Legion_Alpha_20914
legion alpha, 7.0.1 build 20914 (the _lgt.wdt MVER payload bumps 18 -> 20).
constexpr ClientVersion SL_Beta_34490
shadowlands beta, 9.0.1 build 34490 (_lgt.wdt MPL3 point lights).
constexpr ClientVersion WoD
Warlords of Draenor (any 6.x client).
The _lgt.wdt lights satellite entity (WoD+).
Definition records.hpp:16
detail::WDTLights< canonicalVersion(V, WdtLightsPivots, WdtSatelliteVersions)> WDTLights
A _lgt.wdt satellite — the canonicalizing face of detail::WDTLights: three instantiations (WoD; Legio...
Definition lights.hpp:110
constexpr std::array WdtSatelliteVersions
The _occ/_lgt satellites exist since WoD: their era-subset grid.
constexpr std::uint32_t WdtVersion18
The WDT format version every supported client uses (the .wdt and _occ.wdt MVER payload; _lgt/_fogs/_m...
constexpr std::array WdtLightsPivots
WDTLights: the Legion light-set replacement (MPLT out; MPL2/MSLT/MTEX/ MLTA in; the MVER payload bump...
constexpr std::uint32_t fourcc(const char(&cc)[5], FourCCEndian endian=FourCCEndian::Reversed)
The host integer a scanned chunk id compares equal to for code cc.
Definition fourcc.hpp:33
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.
constexpr detail::OptionalSpec Optional
Mark a chunk member the format does not require: absence on read is fine.
consteval detail::UntilSpec until(ClientVersion v)
Restrict a member to entity versions < v (exclusive).
consteval detail::ChunkSpec chunk(const char(&cc)[5], FourCCEndian endian=FourCCEndian::Reversed)
Declare the chunk a member maps to.
consteval detail::SinceSpec since(ClientVersion v)
Restrict a member to entity versions >= v (inclusive).
std::conditional_t<(V.formatLineage() >=Since &&V.formatLineage()< Until), Trait, Absent< Trait > > Slot
A version-gated base: the entity inherits Trait (flattening its chunk members in) iff Since <= V < Un...
The serialization face of a chunked entity, mixed in CRTP-style: an entity struct E : ChunkedFile<E> ...
The version-agnostic base of every WDTLights<V> (welded as "WDTLights"); bindings-only,...
Definition lights.hpp:31
The Legion light set (point v2, spot, textures, animations).
Definition lights.hpp:46
std::vector< std::uint32_t > textureFdids
Light-cookie texture FileDataIDs (MTEX, Legion+), referenced by texture_index.
Definition lights.hpp:57
std::vector< LightAnimation > lightAnimations
Light texture animations (MLTA, Legion+), referenced by mlta_index.
Definition lights.hpp:61
std::vector< MapPointLight > pointLights
The Legion point lights (MPL2); 9.0+ files carry MPL3 instead.
Definition lights.hpp:49
std::vector< MapSpotLight > spotLights
The spot lights (MSLT, Legion+).
Definition lights.hpp:53
The Shadowlands point-light revision.
Definition lights.hpp:65
std::vector< MapPointLight3 > pointLightsV3
The Shadowlands point lights (MPL3, 9.0.1.34490+; replaces MPL2 in shipped files).
Definition lights.hpp:68
The WoD-only point lights, dropped when Legion introduces MPL2.
Definition lights.hpp:39
std::vector< MapPointLightLegacy > legacyPointLights
The WoD point lights (MPLT); Legion+ clients ignore them in favor of MPL2.
Definition lights.hpp:42
A _lgt.wdt lights satellite for one client version (WoD+): the map's freely placed lights.
Definition lights.hpp:85
The conditional-base mechanism that gives a versioned chunked entity exactly the fields its client ve...
WDT version grids and per-family canonicalization pivots.
_lgt.wdt chunk binary structs (namespace wowlib::formats::wdt::lights::chunks): the WoD point lights ...