Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Ktx2Loader.h
Go to the documentation of this file.
1#pragma once
2#include <cstdint>
3#include <filesystem>
4#include <string>
5#include <vector>
6#include <vulkan/vulkan_core.h>
7
8namespace Engine::Assets {
9
10 namespace Textures
11 {
16 uint32_t baseWidth = 0;
17 uint32_t baseHeight = 0;
18 uint32_t sourceWidth = 0;
19 uint32_t sourceHeight = 0;
20 VkFormat vkFormat = VK_FORMAT_UNDEFINED;
21 uint32_t mipLevels = 0;
22 uint32_t sourceMipLevels = 0;
23 uint32_t sourceBaseMip = 0;
24 bool isCompressed = false;
25 std::vector<uint8_t> allData;
26 std::vector<VkDeviceSize> mipOffsets;
27 std::vector<VkDeviceSize> mipSizes;
28 std::vector<uint32_t> mipWidths;
29 std::vector<uint32_t> mipHeights;
30 std::string uri;
31 };
32
33 Ktx2TextureData extractMipRange(const Ktx2TextureData& source, uint32_t firstMip, uint32_t mipCount);
34 }
35
36 namespace Loaders
37 {
41 enum class Ktx2TextureType : uint32_t
42 {
43 BC6H_Unsigned = 0x8E8F, // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT
44 BC6H_Signed = 0x8E8E, // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT
45 BC7_RGBA = 0x8E8C, // GL_COMPRESSED_RGBA_BPTC_UNORM
46 BC7_SRGB = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM
47 BC4_Unsigned = 0x8DBB, // GL_COMPRESSED_RED_RGTC1
48 BC4_Signed = 0x8DBC, // GL_COMPRESSED_SIGNED_RED_RGTC1
49 BC5_Unsigned = 0x8DBD, // GL_COMPRESSED_RG_RGTC2
50 BC5_Signed = 0x8DBE, // GL_COMPRESSED_SIGNED_RG_RGTC2
51 };
52
60 class Ktx2Loader {
61 public:
62 Ktx2Loader() = default;
63 ~Ktx2Loader() = default;
64
65 Textures::Ktx2TextureData load(const std::filesystem::path& filename);
66 };
67 }
68
69} // namespace EngineCore
Textures::Ktx2TextureData load(const std::filesystem::path &filename)
Ktx2TextureType
OpenGL internal format constants for KTX1 texture compression types.
Definition Ktx2Loader.h:42
Ktx2TextureData extractMipRange(const Ktx2TextureData &source, uint32_t firstMip, uint32_t mipCount)
Stores all data loaded from a KTX2 file including mip chain.
Definition Ktx2Loader.h:15
std::vector< VkDeviceSize > mipSizes
Definition Ktx2Loader.h:27
std::vector< VkDeviceSize > mipOffsets
Definition Ktx2Loader.h:26