SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
VVD.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstddef>
5#include <cstdint>
6#include <vector>
7
8#include "MDL.h"
9
10namespace mdlpp::VVD {
11
12struct Fixup {
13 int32_t LOD;
15 int32_t vertexCount;
16};
17
18struct BoneWeight {
19 //float weight[MAX_BONES_PER_VERTEX];
20 std::array<float, MAX_BONES_PER_VERTEX> weight;
21
22 //int8_t bone[MAX_BONES_PER_VERTEX];
23 //int8_t boneCount;
24 std::vector<int8_t> bones;
25};
26
27struct Vertex {
29
30 sourcepp::math::Vec3f position{};
31 sourcepp::math::Vec3f normal{};
32 sourcepp::math::Vec2f uv{};
33
34 sourcepp::math::Vec4f tangent{}; // Taken from tangents data section
35};
36
37struct VVD {
38 [[nodiscard]] bool open(const std::byte* data, std::size_t size, const MDL::MDL& mdl);
39
40 //int32_t id;
41 int32_t version;
42 //int32_t checksum;
43
44 int32_t numLODs;
45 //int32_t numVerticesInLOD[MAX_LOD_COUNT];
46 std::array<int32_t, MAX_LOD_COUNT> numVerticesInLOD;
47
48 //int32_t fixupsCount;
49 //int32_t fixupsOffset;
50 std::vector<Fixup> fixups;
51
52 //int32_t verticesOffset;
53 std::vector<Vertex> vertices;
54 //int32_t tangentsOffset;
55};
56
57} // namespace mdlpp::VVD
Definition: VVD.h:10
std::array< float, MAX_BONES_PER_VERTEX > weight
Definition: VVD.h:20
std::vector< int8_t > bones
Definition: VVD.h:24
int32_t vertexCount
Definition: VVD.h:15
int32_t LOD
Definition: VVD.h:13
int32_t sourceVertexID
Definition: VVD.h:14
std::array< int32_t, MAX_LOD_COUNT > numVerticesInLOD
Definition: VVD.h:46
int32_t numLODs
Definition: VVD.h:44
std::vector< Fixup > fixups
Definition: VVD.h:50
bool open(const std::byte *data, std::size_t size, const MDL::MDL &mdl)
Definition: VVD.cpp:10
int32_t version
Definition: VVD.h:41
std::vector< Vertex > vertices
Definition: VVD.h:53
sourcepp::math::Vec3f normal
Definition: VVD.h:31
sourcepp::math::Vec4f tangent
Definition: VVD.h:34
sourcepp::math::Vec3f position
Definition: VVD.h:30
BoneWeight boneWeight
Definition: VVD.h:28
sourcepp::math::Vec2f uv
Definition: VVD.h:32