MDLParser
Simple and modern library for parsing the Source engine model formats
Loading...
Searching...
No Matches
vtx.hpp
1#pragma once
2
3#include "../enums.hpp"
4#include <array>
5#include <cstdint>
6
7namespace MdlParser::Structs::Vtx {
8#pragma pack(push, 1)
9
10 struct Vertex {
11 std::array<uint8_t, 3> boneWeightIndex;
12 uint8_t numBones;
13
14 uint16_t origMeshVertId;
15
16 std::array<int8_t, 3> boneId;
17 };
18
19 struct Strip {
20 int32_t numIndices;
21 int32_t indexOffset;
22
23 int32_t numVerts;
24 int32_t vertOffset;
25
26 int16_t numBones;
27
29
30 int32_t numBoneStateChanges;
31 int32_t boneStateChangeOffset;
32
33 // this struct has 2 more ints if the MDL version is >= 49, however sdk 2013 uses version 48 (does gmod backport 49?)
34 };
35
36 struct StripGroup {
37 int32_t numVerts;
38 int32_t vertOffset;
39
40 int32_t numIndices;
41 int32_t indexOffset;
42
43 int32_t numStrips;
44 int32_t stripOffset;
45
47
48 // this struct has 2 more ints if the MDL version is >= 49, however sdk 2013 uses version 48 (does gmod backport 49?)
49 };
50
51 struct Mesh {
52 int32_t numStripGroups;
53 int32_t stripGroupHeaderOffset;
54
56 };
57
58 struct ModelLoD {
59 int32_t numMeshes;
60 int32_t meshOffset;
61
62 float switchPoint;
63 };
64
65 struct Model {
66 int32_t numLoDs;
67 int32_t lodOffset;
68 };
69
70 struct BodyPart {
71 int32_t numModels;
72 int32_t modelOffset;
73 };
74
76 int16_t materialId;
77 int32_t replacementMaterialNameOffset;
78 };
79
81 int32_t replacementCount;
82 int32_t replacementOffset;
83 };
84
85 struct Header {
86 static constexpr int32_t SUPPORTED_VERSION = 7;
87
88 int32_t version;
89
90 int32_t vertCacheSize;
91 uint16_t maxBonesPerStrip;
92 uint16_t maxBonesPerTri;
93 int32_t maxBonesPerVert;
94
95 int32_t checksum;
96
97 int32_t numLoDs;
98
99 int32_t materialReplacementListOffset;
100
101 int32_t numBodyParts;
102 int32_t bodyPartOffset;
103 };
104
105#pragma pack(pop)
106}
StripGroupFlags
Definition: enums.hpp:75
StripFlags
Definition: enums.hpp:49
MeshFlags
Definition: enums.hpp:96
Definition: vtx.hpp:70
Definition: vtx.hpp:85
Definition: vtx.hpp:51
Definition: vtx.hpp:58
Definition: vtx.hpp:65
Definition: vtx.hpp:19
Definition: vtx.hpp:10