SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Toggle main menu visibility
Loading...
Searching...
No Matches
mdlpp.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
#include "
structs/MDL.h
"
6
#include "
structs/VTX.h
"
7
#include "
structs/VVD.h
"
8
9
namespace
mdlpp
{
10
14
struct
BakedModel
{
15
struct
Vertex
{
16
sourcepp::math::Vec3f
position
;
17
sourcepp::math::Vec3f
normal
;
18
sourcepp::math::Vec2f
uv
;
19
};
20
std::vector<Vertex>
vertices
;
21
22
struct
Mesh
{
23
std::vector<uint16_t>
indices
;
24
int32_t
materialIndex
= -1;
25
};
26
std::vector<Mesh>
meshes
;
27
};
28
29
struct
StudioModel
{
30
[[nodiscard]]
bool
open
(
const
std::byte* mdlData, std::size_t mdlSize,
31
const
std::byte* vtxData, std::size_t vtxSize,
32
const
std::byte* vvdData, std::size_t vvdSize);
33
34
[[nodiscard]]
bool
open
(
const
unsigned
char
* mdlData, std::size_t mdlSize,
35
const
unsigned
char
* vtxData, std::size_t vtxSize,
36
const
unsigned
char
* vvdData, std::size_t vvdSize);
37
38
[[nodiscard]]
bool
open
(
const
std::vector<std::byte>& mdlData,
39
const
std::vector<std::byte>& vtxData,
40
const
std::vector<std::byte>& vvdData);
41
42
[[nodiscard]]
bool
open
(
const
std::vector<unsigned char>& mdlData,
43
const
std::vector<unsigned char>& vtxData,
44
const
std::vector<unsigned char>& vvdData);
45
46
[[nodiscard]]
explicit
operator
bool()
const
;
47
48
[[nodiscard]]
BakedModel
processModelData
(
int
currentLOD =
ROOT_LOD
)
const
;
49
50
MDL::MDL
mdl
;
51
VTX::VTX
vtx
;
52
VVD::VVD
vvd
;
53
54
private
:
55
bool
opened =
false
;
56
};
57
58
}
// namespace mdlpp
MDL.h
VTX.h
VVD.h
mdlpp
Definition
mdlpp.h:9
mdlpp::ROOT_LOD
constexpr int ROOT_LOD
Definition
Generic.h:10
mdlpp::BakedModel::Mesh
Definition
mdlpp.h:22
mdlpp::BakedModel::Mesh::materialIndex
int32_t materialIndex
Definition
mdlpp.h:24
mdlpp::BakedModel::Mesh::indices
std::vector< uint16_t > indices
Definition
mdlpp.h:23
mdlpp::BakedModel::Vertex
Definition
mdlpp.h:15
mdlpp::BakedModel::Vertex::uv
sourcepp::math::Vec2f uv
Definition
mdlpp.h:18
mdlpp::BakedModel::Vertex::position
sourcepp::math::Vec3f position
Definition
mdlpp.h:16
mdlpp::BakedModel::Vertex::normal
sourcepp::math::Vec3f normal
Definition
mdlpp.h:17
mdlpp::BakedModel
A more accessible version of StudioModel's vertex data, so it can be rendered or converted more easil...
Definition
mdlpp.h:14
mdlpp::BakedModel::vertices
std::vector< Vertex > vertices
Definition
mdlpp.h:20
mdlpp::BakedModel::meshes
std::vector< Mesh > meshes
Definition
mdlpp.h:26
mdlpp::MDL::MDL
Definition
MDL.h:681
mdlpp::StudioModel
Definition
mdlpp.h:29
mdlpp::StudioModel::mdl
MDL::MDL mdl
Definition
mdlpp.h:50
mdlpp::StudioModel::open
bool open(const std::byte *mdlData, std::size_t mdlSize, const std::byte *vtxData, std::size_t vtxSize, const std::byte *vvdData, std::size_t vvdSize)
Definition
mdlpp.cpp:10
mdlpp::StudioModel::processModelData
BakedModel processModelData(int currentLOD=ROOT_LOD) const
Definition
mdlpp.cpp:53
mdlpp::StudioModel::vvd
VVD::VVD vvd
Definition
mdlpp.h:52
mdlpp::StudioModel::vtx
VTX::VTX vtx
Definition
mdlpp.h:51
mdlpp::VTX::VTX
Definition
VTX.h:120
mdlpp::VVD::VVD
Definition
VVD.h:37
include
mdlpp
mdlpp.h
Generated on
for SourcePP by
1.17.0