SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
HOT.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <span>
5#include <string>
6#include <vector>
7
8#include <sourcepp/Macros.h>
9#include <sourcepp/Math.h>
10
11namespace vtfpp {
12
13class HOT {
14public:
15 struct Rect {
16 enum Flags : uint8_t {
22 uint16_t x1;
23 uint16_t y1;
24 uint16_t x2;
25 uint16_t y2;
26 };
27
28 HOT();
29
30 explicit HOT(std::span<const std::byte> hotData);
31
32 explicit HOT(const std::string& hotPath);
33
34 [[nodiscard]] explicit operator bool() const;
35
36 [[nodiscard]] uint8_t getVersion() const;
37
38 void setVersion(uint8_t v);
39
40 [[nodiscard]] uint8_t getFlags() const;
41
42 void setFlags(uint8_t f);
43
44 [[nodiscard]] const std::vector<Rect>& getRects() const;
45
46 [[nodiscard]] std::vector<Rect>& getRects();
47
48 [[nodiscard]] std::vector<std::byte> bake() const;
49
50 bool bake(const std::string& hotPath) const; // NOLINT(*-use-nodiscard)
51
52protected:
53 bool opened;
54
55 uint8_t version = 1;
56 uint8_t flags = 0;
57 std::vector<Rect> rects;
58};
60
61} // namespace vtfpp
#define SOURCEPP_BITFLAGS_ENUM(Enum)
Defines bitwise operators for an enum or enum class.
Definition: Macros.h:26
Definition: HOT.h:13
std::vector< std::byte > bake() const
Definition: HOT.cpp:61
void setVersion(uint8_t v)
Definition: HOT.cpp:38
HOT()
Definition: HOT.cpp:8
std::vector< Rect > rects
Definition: HOT.h:57
const std::vector< Rect > & getRects() const
Definition: HOT.cpp:53
uint8_t getFlags() const
Definition: HOT.cpp:45
void setFlags(uint8_t f)
Definition: HOT.cpp:49
bool opened
Definition: HOT.h:53
uint8_t flags
Definition: HOT.h:56
uint8_t version
Definition: HOT.h:55
uint8_t getVersion() const
Definition: HOT.cpp:34
Definition: HOT.h:11
uint16_t y2
Definition: HOT.h:25
uint16_t x1
Definition: HOT.h:22
uint16_t x2
Definition: HOT.h:24
@ FLAG_IS_ALTERNATE
Definition: HOT.h:20
@ FLAG_RANDOM_REFLECTION
Definition: HOT.h:19
@ FLAG_RANDOM_ROTATION
Definition: HOT.h:18
uint16_t y1
Definition: HOT.h:23
enum vtfpp::HOT::Rect::Flags flags