wowlib
0.0.0
Read & write World of Warcraft client files — a C++26 core
Toggle main menu visibility
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
14
#include <
wowlib/formats/common/flags.hpp
>
15
#include <
wowlib/formats/common/types.hpp
>
16
17
namespace
wowlib::formats::wmo::root::chunks
{
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
};
34
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."
)]]
44
MaterialFlags
flags
{};
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."
)]]
56
CImVector
sidnColor
{};
57
58
[[=welder::doc(
"Runtime sidn slot; zero on disk."
)]]
59
CImVector
frameSidnColor
{};
60
61
[[=welder::doc(
"Second texture: MOTX offset or FileDataID."
)]]
62
std::uint32_t
texture2
= 0;
63
64
[[=welder::doc(
"Diffuse color."
)]]
65
CImVector
diffColor
{};
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;
75
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
}
flags.hpp
Flag-testing convenience for the binary formats' bit-mask enums.
wowlib::formats::wmo::root::chunks
WMO root-file chunk binary structs (MOHD, MOMT, lights, doodads, fog, ambient volumes) and their flag...
Definition
doodad.hpp:17
wowlib::formats::wmo::root::chunks::MaterialFlags
MaterialFlags
Material flag bits (SMOMaterial.flags).
Definition
material.hpp:21
wowlib::formats::wmo::root::chunks::MaterialFlags::TwoSided
@ TwoSided
Disable backface culling.
Definition
material.hpp:24
wowlib::formats::wmo::root::chunks::MaterialFlags::Sidn
@ Sidn
Self-illuminated at day and night (window glow).
Definition
material.hpp:26
wowlib::formats::wmo::root::chunks::MaterialFlags::Unfogged
@ Unfogged
Disable fog.
Definition
material.hpp:23
wowlib::formats::wmo::root::chunks::MaterialFlags::ClampS
@ ClampS
Clamp texture addressing on S.
Definition
material.hpp:28
wowlib::formats::wmo::root::chunks::MaterialFlags::ExtLight
@ ExtLight
Use exterior lighting on interior surfaces.
Definition
material.hpp:25
wowlib::formats::wmo::root::chunks::MaterialFlags::Window
@ Window
A window (lighting special case).
Definition
material.hpp:27
wowlib::formats::wmo::root::chunks::MaterialFlags::Unlit
@ Unlit
Disable lighting.
Definition
material.hpp:22
wowlib::formats::wmo::root::chunks::MaterialFlags::ClampT
@ ClampT
Clamp texture addressing on T.
Definition
material.hpp:29
wowlib::formats::common::CImVector
A color stored as b, g, r, a bytes — the client's immediate-mode vertex color layout (WMO MOCV,...
Definition
types.hpp:178
wowlib::formats::wmo::root::chunks::SMOMaterial
Definition
material.hpp:32
wowlib::formats::wmo::root::chunks::SMOMaterial::flags
MaterialFlags flags
Render flags; MaterialFlags bits.
Definition
material.hpp:34
wowlib::formats::wmo::root::chunks::SMOMaterial::texture1
std::uint32_t texture1
First texture: MOTX offset or FileDataID.
Definition
material.hpp:43
wowlib::formats::wmo::root::chunks::SMOMaterial::texture3
std::uint32_t texture3
Third texture: MOTX offset or FileDataID.
Definition
material.hpp:61
wowlib::formats::wmo::root::chunks::SMOMaterial::texture2
std::uint32_t texture2
Second texture: MOTX offset or FileDataID.
Definition
material.hpp:52
wowlib::formats::wmo::root::chunks::SMOMaterial::diffColor
CImVector diffColor
Diffuse color.
Definition
material.hpp:55
wowlib::formats::wmo::root::chunks::SMOMaterial::blendMode
std::uint32_t blendMode
Blending mode (EGxBlend).
Definition
material.hpp:40
wowlib::formats::wmo::root::chunks::SMOMaterial::runTimeData
std::array< std::uint32_t, 4 > runTimeData
Nulled on load; shader-23 texture FileDataIDs.
Definition
material.hpp:70
wowlib::formats::wmo::root::chunks::SMOMaterial::color2
std::uint32_t color2
Extra color slot (a texture FileDataID for shader 23).
Definition
material.hpp:64
wowlib::formats::wmo::root::chunks::SMOMaterial::sidnColor
CImVector sidnColor
Self-illuminated (night glow) color.
Definition
material.hpp:46
wowlib::formats::wmo::root::chunks::SMOMaterial::flags2
std::uint32_t flags2
Extra flags slot (a texture FileDataID for shader 23).
Definition
material.hpp:67
wowlib::formats::wmo::root::chunks::SMOMaterial::shader
std::uint32_t shader
Index into the client's WMO shader table.
Definition
material.hpp:37
wowlib::formats::wmo::root::chunks::SMOMaterial::groundType
std::uint32_t groundType
Foreign key into TerrainType.
Definition
material.hpp:58
wowlib::formats::wmo::root::chunks::SMOMaterial::frameSidnColor
CImVector frameSidnColor
Runtime sidn slot; zero on disk.
Definition
material.hpp:49
wowlib::formats::wmo::root::chunks::UVAnimation
Definition
material.hpp:75
wowlib::formats::wmo::root::chunks::UVAnimation::translationSpeed
std::array< C2Vector, 2 > translationSpeed
Translation speed per animated texture layer.
Definition
material.hpp:77
types.hpp
The binary-level math and color primitives shared across WoW file formats (wowdev....
src
wowlib
formats
wmo
root
chunks
material.hpp
Generated by
1.17.0