wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
environment.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/core/lang.hpp>
17
19 // --- MFOG / MFED ------------------------------------------------------------
20
21 struct [[
22 =welder::weld,
23 =welder::doc("One MFOG entry: a fog volume with regular and under-water "
24 "settings.")
25 ]] SMOFog {
26 // C# ONLY: the nested type and the `fog` member below both style to `Fog`,
27 // and C# forbids a type and a member sharing a name (CS0102) — welder
28 // diagnoses it at generation. Renaming the TYPE keeps the natural property
29 // spelling (`smoFog.Fog` stays the fog band). Python and Lua are unaffected:
30 // there the nested type is `Fog` and the member `fog`, which do not collide.
31 struct [[=welder::weld_as(wowlib::lang::Cs, "FogBand"),
32 =welder::doc("One fog band: end distance, start scalar and color.")]]
33 Fog {
34 [[=welder::doc("Distance at which visibility ceases.")]]
35 float end = 0;
36
37 [[=welder::doc("Start = end * start_scalar (0..1).")]]
38 float startScalar = 0;
39
40 [[=welder::doc("Fog color.")]]
42 };
43
44 [[=welder::doc("0x1: infinite radius (interior/exterior blend fog).")]]
45 std::uint32_t flags = 0;
46
47 [[=welder::doc("Fog volume center.")]]
49
50 [[=welder::doc("Inner radius (full fog).")]]
51 float smallerRadius = 0;
52
53 [[=welder::doc("Outer radius (fog starts).")]]
54 float largerRadius = 0;
55
56 [[=welder::doc("The regular fog band.")]]
58
59 [[=welder::doc("The under-water fog band.")]]
60 Fog underWaterFog{};
61 };
62
63 static_assert(sizeof(SMOFog) == 0x30);
64
65 struct [[
66 =welder::weld,
67 =welder::doc("One MFED entry (9.0+): fog extra data; same count as MFOG.")
69 [[=welder::doc("The doodad set this fog applies to.")]]
70 std::uint16_t doodadSetId = 0;
71
73 [[=welder::mark::exclude]] std::array<std::uint8_t, 14> unknown{};
74 };
76 static_assert(sizeof(FogExtra) == 0x10);
78 // --- MAVD / MAVG / MBVD -----------------------------------------------------
79
80 struct [[
81 =welder::weld,
82 =welder::doc(R"(
83 One ambient volume (MAVD, 8.3+) - a spherical region overriding the
84 root ambient color - or a global ambient entry (MAVG), which shares
85 the layout with position/start/end zeroed.)")
87 [[=welder::doc("Volume center (zero in MAVG).")]]
90 [[=welder::doc("Inner radius (zero in MAVG).")]]
91 float start = 0;
93 [[=welder::doc("Outer radius (zero in MAVG).")]]
94 float end = 0;
96 [[=welder::doc("Primary ambient color; overrides the MOHD ambient.")]]
99 [[=welder::doc("Secondary ambient color.")]]
102 [[=welder::doc("Tertiary ambient color.")]]
104
105 [[=welder::doc("0x1: blend color_1 and color_3.")]]
106 std::uint32_t flags = 0;
108 [[=welder::doc("The doodad set this volume applies to.")]]
109 std::uint16_t doodadSetId = 0;
110
112 [[=welder::mark::exclude]] std::array<std::uint8_t, 10> unknown{};
113 };
114
115 static_assert(sizeof(AmbientVolume) == 0x30);
116
117 struct [[
118 =welder::weld,
119 =welder::doc(
120 "One MBVD entry (8.3+): a box-shaped ambient volume bounded by "
121 "six planes. Only read when MAVG or MAVD is present.")
123 [[=welder::doc("The six bounding planes (position and start combined).")]]
124 std::array<C4Plane, 6> planes{};
125
126 [[=welder::doc("Outer distance.")]]
127 float end = 0;
128
129 [[=welder::doc("Primary ambient color.")]]
131
132 [[=welder::doc("Secondary ambient color.")]]
133 CImVector color2{};
134
135 [[=welder::doc("Tertiary ambient color.")]]
136 CImVector color3{};
137
138 [[=welder::doc("0x1: blend color_2 and color_3.")]]
139 std::uint32_t flags = 0;
140
141 [[=welder::doc("The doodad set this volume applies to.")]]
142 std::uint16_t doodadSetId = 0;
143
145 [[=welder::mark::exclude]] std::array<std::uint8_t, 10> unknown{};
146 };
147
148 static_assert(sizeof(AmbientBoxVolume) == 0x80);
149}
Flag-testing convenience for the binary formats' bit-mask enums.
Binding-language identities welder's core does not name.
WMO root-file chunk binary structs (MOHD, MOMT, lights, doodads, fog, ambient volumes) and their flag...
Definition doodad.hpp:17
constexpr welder::lang Cs
C#/.NET — the welder-csharp rod's identity (user-range slot 0), respelled for wowlib's annotation sit...
Definition lang.hpp:23
A 3D float vector — the workhorse: positions, normals, rotations-as-Euler-degrees in placements.
Definition types.hpp:49
A color stored as b, g, r, a bytes — the client's immediate-mode vertex color layout (WMO MOCV,...
Definition types.hpp:178
One MBVD entry (8.3+): a box-shaped ambient volume bounded by six planes.
std::uint16_t doodadSetId
The doodad set this volume applies to.
std::array< C4Plane, 6 > planes
The six bounding planes (position and start combined).
std::array< std::uint8_t, 10 > unknown
Undeciphered remainder of the record.
std::uint32_t flags
0x1: blend color_2 and color_3.
float start
Inner radius (zero in MAVG).
CImVector color2
Secondary ambient color.
float end
Outer radius (zero in MAVG).
CImVector color1
Primary ambient color; overrides the MOHD ambient.
C3Vector position
Volume center (zero in MAVG).
std::uint16_t doodadSetId
The doodad set this volume applies to.
std::uint32_t flags
0x1: blend color_1 and color_3.
CImVector color3
Tertiary ambient color.
std::array< std::uint8_t, 10 > unknown
Undeciphered remainder of the record.
One MFED entry (9.0+): fog extra data; same count as MFOG.
std::uint16_t doodadSetId
The doodad set this fog applies to.
std::array< std::uint8_t, 14 > unknown
Undeciphered remainder of the record.
One fog band: end distance, start scalar and color.
float end
Distance at which visibility ceases.
float startScalar
Start = end * start_scalar (0..1).
One MFOG entry: a fog volume with regular and under-water settings.
std::uint32_t flags
0x1: infinite radius (interior/exterior blend fog).
float largerRadius
Outer radius (fog starts).
float smallerRadius
Inner radius (full fog).
Fog underWaterFog
The under-water fog band.
The binary-level math and color primitives shared across WoW file formats (wowdev....