VTFParser
Simple and modern library for parsing the Valve Texture Format
Loading...
Searching...
No Matches
header.hpp
1#pragma once
2
3#include "enums.hpp"
4#include <array>
5#include <cstddef>
6#include <cstdint>
7
8namespace VtfParser {
9#pragma pack(push, 1)
10
14 struct HeaderBase {
18 std::array<uint8_t, 4> signature;
22 std::array<uint32_t, 2> version;
26 uint32_t headerSize;
27 };
28
32 struct __attribute__((aligned(16))) HeaderFullAligned : public HeaderBase {
36 uint16_t width;
40 uint16_t height;
44 TextureFlags flags;
48 uint16_t frames;
52 uint16_t firstFrame;
56 std::array<uint8_t, 4> padding0;
60 std::array<float, 3> reflectivity;
64 std::array<uint8_t, 4> padding1;
68 float bumpmapScale;
72 ImageFormat highResImageFormat;
76 uint8_t mipmapCount;
80 ImageFormat lowResImageFormat;
84 uint8_t lowResImageWidth;
88 uint8_t lowResImageHeight;
92 uint16_t depth;
96 std::array<uint8_t, 3> padding2;
100 uint32_t numResources;
101 };
102
110 std::array<uint8_t, 3> tag;
115 uint8_t flags;
119 uint32_t data;
120 };
121
125 struct Header : public HeaderFullAligned {
126 static constexpr size_t MAX_RESOURCES = 32;
127
128 std::array<uint8_t, 8> padding3;
129 std::array<ResourceEntryInfo, MAX_RESOURCES> resourceInfos;
130 };
131
132#pragma pack(pop)
133}
Definition: VTFParser.hpp:6
TextureFlags
Definition: enums.hpp:44
ImageFormat
Definition: enums.hpp:10
Definition: header.hpp:14
std::array< uint8_t, 4 > signature
Definition: header.hpp:18
std::array< uint32_t, 2 > version
Definition: header.hpp:22
uint32_t headerSize
Definition: header.hpp:26
Definition: header.hpp:125
Definition: header.hpp:106
uint8_t flags
Definition: header.hpp:115
uint32_t data
Definition: header.hpp:119
std::array< uint8_t, 3 > tag
Definition: header.hpp:110