wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
structure.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 // --- MOGI / MGI2 ------------------------------------------------------------
19
20 struct [[
21 =welder::weld,
22 =welder::doc(
23 "One MOGI entry: per-group flags, bounds and name, mirrored from "
24 "the group file's own header.")
25 ]] SMOGroupInfo {
26 [[=welder::doc("Group flags; the same GroupFlags bits as MOGP.")]]
28
29 [[=welder::doc("Group bounding box.")]]
31
32 [[=welder::doc("Byte offset of the group name in MOGN, -1 for no name.")]]
33 std::int32_t nameOffset = -1;
34 };
35
36 static_assert(sizeof(SMOGroupInfo) == 0x20);
37
38 struct [[
39 =welder::weld,
40 =welder::doc(R"(
41 One MGI2 entry (9.0+): group info v2. Same count as MOGI; when present
42 it overrides the older LOD-selection logic.)")
43 ]] GroupInfo2 {
44 [[=welder::doc("A copy of the group file's flags2; GroupFlags2 bits.")]]
46
47 [[=welder::doc("Which LOD level this group belongs to.")]]
48 std::uint32_t lodIndex = 0;
49 };
50
51 static_assert(sizeof(GroupInfo2) == 0x8);
53 // --- MOPT / MOPR / MOPE / MOVB ----------------------------------------------
54
55 struct [[
56 =welder::weld,
57 =welder::doc("One MOPT portal: a polygon plane separating two groups.")
58 ]] SMOPortal {
59 [[=welder::doc("First vertex in MOPV.")]]
60 std::uint16_t startVertex = 0;
62 [[=welder::doc("Vertex count.")]]
63 std::uint16_t count = 0;
64
65 [[=welder::doc("The portal plane.")]]
66 C4Plane plane{};
67 };
68
69 static_assert(sizeof(SMOPortal) == 0x14);
70
71 struct [[
72 =welder::weld,
73 =welder::doc(
74 "One MOPR entry: a group's reference to a portal and the group "
75 "on the other side.")
76 ]] SMOPortalRef {
77 [[=welder::doc("Index into MOPT.")]]
78 std::uint16_t portalIndex = 0;
79
80 [[=welder::doc("The group on the other side of the portal.")]]
81 std::uint16_t groupIndex = 0;
82
83 [[=welder::doc("Which side of the portal plane this reference looks from.")]
84 ]
85 std::int16_t side = 0;
86
87 [[=welder::doc("Alignment filler; zero in client files.")]]
88 std::uint16_t filler = 0;
89 };
91 static_assert(sizeof(SMOPortalRef) == 0x8);
92
93 struct [[
94 =welder::weld,
95 =welder::doc(
96 "One MOPE entry (11.1+): portal extra data; largely undeciphered.")
97 ]] PortalExtra {
98 [[=welder::doc("Index into MOPT; seems to match MOPR values.")]]
99 std::uint32_t portalIndex = 0;
100
101 [[=welder::doc("Unknown; preserved for round-trip.")]]
102 std::uint32_t unknown1 = 0;
104 [[=welder::doc("Unknown; preserved for round-trip.")]]
105 std::uint32_t unknown2 = 0;
107 [[=welder::doc("Unknown; preserved for round-trip.")]]
108 std::uint32_t unknown3 = 0;
109 };
110
111 static_assert(sizeof(PortalExtra) == 0x10);
112
113 struct [[
114 =welder::weld,
115 =welder::doc("One MOVB visible block: a vertex range in MOVV.")
116 ]] SMOVisibleBlock {
117 [[=welder::doc("First vertex in MOVV.")]]
118 std::uint16_t firstVertex = 0;
119
120 [[=welder::doc("Vertex count.")]]
121 std::uint16_t count = 0;
122 };
123
124 static_assert(sizeof(SMOVisibleBlock) == 0x4);
125}
Flag-testing convenience for the binary formats' bit-mask enums.
GroupFlags
Group flag bits (MOGP and MOGI flags).
Definition header.hpp:22
GroupFlags2
Extended group flag bits (MOGP.flags2 and MGI2).
Definition header.hpp:60
WMO root-file chunk binary structs (MOHD, MOMT, lights, doodads, fog, ambient volumes) and their flag...
Definition doodad.hpp:17
A plane as a normal and its signed distance from the origin.
Definition types.hpp:124
An axis-aligned bounding box: minimum and maximum corners.
Definition types.hpp:134
group::chunks::GroupFlags2 flags2
A copy of the group file's flags2; GroupFlags2 bits.
Definition structure.hpp:36
std::uint32_t lodIndex
Which LOD level this group belongs to.
Definition structure.hpp:39
One MOGI entry: per-group flags, bounds and name, mirrored from the group file's own header.
Definition structure.hpp:21
std::int32_t nameOffset
Byte offset of the group name in MOGN, -1 for no name.
Definition structure.hpp:29
group::chunks::GroupFlags flags
Group flags; the same GroupFlags bits as MOGP.
Definition structure.hpp:23
One MOPR entry: a group's reference to a portal and the group on the other side.
Definition structure.hpp:61
std::uint16_t groupIndex
The group on the other side of the portal.
Definition structure.hpp:66
std::uint16_t portalIndex
Index into MOPT.
Definition structure.hpp:63
One MOPT portal: a polygon plane separating two groups.
Definition structure.hpp:47
std::uint16_t startVertex
First vertex in MOPV.
Definition structure.hpp:49
The binary-level math and color primitives shared across WoW file formats (wowdev....