wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
material.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
16
18 // --- MOMT / MOUV ------------------------------------------------------------
19
20 enum class [[
21 =welder::weld,
22 =welder::flags,
23 =welder::doc("Material flag bits (SMOMaterial.flags).")
24 ]] MaterialFlags : std::uint32_t {
25 Unlit [[=welder::doc("Disable lighting.")]] = 0x1,
26 Unfogged [[=welder::doc("Disable fog.")]] = 0x2,
27 TwoSided [[=welder::doc("Disable backface culling.")]] = 0x4,
28 ExtLight [[=welder::doc("Use exterior lighting on interior surfaces.")]] = 0x8,
29 Sidn [[=welder::doc("Self-illuminated at day and night (window glow).")]] = 0x10,
30 Window [[=welder::doc("A window (lighting special case).")]] = 0x20,
31 ClampS [[=welder::doc("Clamp texture addressing on S.")]] = 0x40,
32 ClampT [[=welder::doc("Clamp texture addressing on T.")]] = 0x80
33 };
35 struct [[
36 =welder::weld,
37 =welder::doc(R"(
38 One MOMT material, 64 bytes. The layout is stable across v17; what
39 changed in 8.1 is the meaning of the texture fields - MOTX byte offsets
40 before (and in the fallback mode signalled by MOTX's presence),
41 FileDataIDs after.)")
42 ]] SMOMaterial {
43 [[=welder::doc("Render flags; MaterialFlags bits.")]]
45
46 [[=welder::doc("Index into the client's WMO shader table.")]]
47 std::uint32_t shader = 0;
48
49 [[=welder::doc("Blending mode (EGxBlend).")]]
50 std::uint32_t blendMode = 0;
51
52 [[=welder::doc("First texture: MOTX offset or FileDataID.")]]
53 std::uint32_t texture1 = 0;
54
55 [[=welder::doc("Self-illuminated (night glow) color.")]]
57
58 [[=welder::doc("Runtime sidn slot; zero on disk.")]]
60
61 [[=welder::doc("Second texture: MOTX offset or FileDataID.")]]
62 std::uint32_t texture2 = 0;
63
64 [[=welder::doc("Diffuse color.")]]
66
67 [[=welder::doc("Foreign key into TerrainType.")]]
68 std::uint32_t groundType = 0;
69
70 [[=welder::doc("Third texture: MOTX offset or FileDataID.")]]
71 std::uint32_t texture3 = 0;
72
73 [[=welder::doc("Extra color slot (a texture FileDataID for shader 23).")]]
74 std::uint32_t color2 = 0;
76 [[=welder::doc("Extra flags slot (a texture FileDataID for shader 23).")]]
77 std::uint32_t flags2 = 0;
78
79 [[=welder::doc("Nulled on load; shader-23 texture FileDataIDs.")]]
80 std::array<std::uint32_t, 4> runTimeData{};
81 };
82
83 static_assert(sizeof(SMOMaterial) == 0x40);
84
85 struct [[
86 =welder::weld,
87 =welder::doc(R"(
88 One MOUV entry (7.3+): texture-coordinate translation speeds for two of
89 the material's texture layers. Same count as the materials; all-zero
90 entries mean no animation.)")
91 ]] UVAnimation {
92 [[=welder::doc("Translation speed per animated texture layer.")]]
93 std::array<C2Vector, 2> translationSpeed{};
94 };
95
96 static_assert(sizeof(UVAnimation) == 0x10);
97}
Flag-testing convenience for the binary formats' bit-mask enums.
WMO root-file chunk binary structs (MOHD, MOMT, lights, doodads, fog, ambient volumes) and their flag...
Definition doodad.hpp:17
MaterialFlags
Material flag bits (SMOMaterial.flags).
Definition material.hpp:21
@ Sidn
Self-illuminated at day and night (window glow).
Definition material.hpp:26
@ ClampS
Clamp texture addressing on S.
Definition material.hpp:28
@ ExtLight
Use exterior lighting on interior surfaces.
Definition material.hpp:25
@ Window
A window (lighting special case).
Definition material.hpp:27
@ ClampT
Clamp texture addressing on T.
Definition material.hpp:29
A color stored as b, g, r, a bytes — the client's immediate-mode vertex color layout (WMO MOCV,...
Definition types.hpp:178
MaterialFlags flags
Render flags; MaterialFlags bits.
Definition material.hpp:34
std::uint32_t texture1
First texture: MOTX offset or FileDataID.
Definition material.hpp:43
std::uint32_t texture3
Third texture: MOTX offset or FileDataID.
Definition material.hpp:61
std::uint32_t texture2
Second texture: MOTX offset or FileDataID.
Definition material.hpp:52
std::uint32_t blendMode
Blending mode (EGxBlend).
Definition material.hpp:40
std::array< std::uint32_t, 4 > runTimeData
Nulled on load; shader-23 texture FileDataIDs.
Definition material.hpp:70
std::uint32_t color2
Extra color slot (a texture FileDataID for shader 23).
Definition material.hpp:64
CImVector sidnColor
Self-illuminated (night glow) color.
Definition material.hpp:46
std::uint32_t flags2
Extra flags slot (a texture FileDataID for shader 23).
Definition material.hpp:67
std::uint32_t shader
Index into the client's WMO shader table.
Definition material.hpp:37
std::uint32_t groundType
Foreign key into TerrainType.
Definition material.hpp:58
CImVector frameSidnColor
Runtime sidn slot; zero on disk.
Definition material.hpp:49
std::array< C2Vector, 2 > translationSpeed
Translation speed per animated texture layer.
Definition material.hpp:77
The binary-level math and color primitives shared across WoW file formats (wowdev....