3#include <BufferStream.h>
12 BufferStreamReadOnly stream{data, size};
14 if (stream.read<int32_t>() !=
VVD_ID) {
18 if (stream.read(this->version); this->version != 4) {
22 if (stream.read<int32_t>() != mdl.
checksum) {
30 const auto fixupsCount = stream.read<int32_t>();
31 const auto fixupsOffset = stream.read<int32_t>();
32 const auto verticesOffset = stream.read<int32_t>();
33 const auto tangentsOffset = stream.read<int32_t>();
35 stream.seek(verticesOffset);
37 auto& [boneWeight, position, normal, uv, tangent] = this->
vertices.emplace_back();
39 stream.read(boneWeight.weight);
41 std::array<int8_t, MAX_BONES_PER_VERTEX> bones{};
43 const auto boneCount = stream.read<int8_t>();
45 boneWeight.bones.push_back(bones[j]);
55 stream.seek(tangentsOffset);
56 for (std::size_t i = 0; i < this->numVerticesInLOD[0]; i++) {
57 this->
vertices.at(i).tangent = stream.read<math::Vec4f>();
60 stream.seek(fixupsOffset);
61 for (
int i = 0; i < fixupsCount; i++) {
62 auto& [LOD, sourceVertexID, vertexCount] = this->
fixups.emplace_back();
63 stream >> LOD >> sourceVertexID >> vertexCount;
constexpr int MAX_BONES_PER_VERTEX
consteval uint32_t makeFourCC(const char fourCC[4])
Creates a FourCC identifier from a string of 4 characters.
std::array< int32_t, MAX_LOD_COUNT > numVerticesInLOD
std::vector< Fixup > fixups
bool open(const std::byte *data, std::size_t size, const MDL::MDL &mdl)
std::vector< Vertex > vertices