nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
dds_image.h
1#ifndef NXDK_PGRAPH_TESTS_DDS_IMAGE_H
2#define NXDK_PGRAPH_TESTS_DDS_IMAGE_H
3
4#include <cstdint>
5#include <memory>
6#include <vector>
7
8class DDSImage {
9 public:
10 struct SubImage {
11 enum class Format { NONE, DXT1, DXT3, DXT5 };
12
13 uint32_t level;
14 Format format;
15 uint32_t width;
16 uint32_t height;
17 uint32_t compressed_width;
18 uint32_t compressed_height;
19 uint32_t depth;
20 uint32_t pitch;
21 uint32_t bytes_per_pixel;
22 std::vector<uint8_t> data;
23 };
24
25 public:
26 DDSImage() = default;
27
28 bool LoadFile(const char *filename, bool load_mipmaps = false);
29
30 inline std::shared_ptr<SubImage> GetPrimaryImage() const { return GetSubImage(0); }
31 std::shared_ptr<SubImage> GetSubImage(uint32_t mipmap_level = 0) const;
32 const std::vector<std::shared_ptr<SubImage>> &GetSubImages() const { return sub_images_; }
33
34 uint32_t NumLevels() const { return sub_images_.size(); }
35
36 private:
37 bool loaded_{false};
38 std::vector<std::shared_ptr<SubImage>> sub_images_{};
39};
40
41#endif // NXDK_PGRAPH_TESTS_DDS_IMAGE_H
Definition dds_image.h:8
Definition dds_image.h:10