Hymn to Beauty
C++ 3D Engine
VulkanTexture.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../Interface/Texture.hpp"
4
5#include <glm/glm.hpp>
6#include <vulkan/vulkan.h>
7
8namespace Video {
9
10class VulkanRenderer;
11
13class VulkanTexture : public Texture {
14 public:
16
26 VulkanTexture(VulkanRenderer& vulkanRenderer, VkDevice device, VkPhysicalDevice physicalDevice, const glm::uvec2 size, Texture::Type type, Texture::Format format, int components = 0, unsigned char* data = nullptr);
27
29 ~VulkanTexture() final;
30
32
35 VkFormat GetFormat() const;
36
38
41 VkImage GetImage() const;
42
44
47 VkImageView GetImageView() const;
48
50
53 VkImageLayout GetImageLayout() const;
54
56
59 void SetImageLayout(VkImageLayout layout);
60
61 private:
62 VulkanTexture(const VulkanTexture& other) = delete;
63
64 void GenerateMipMaps(VulkanRenderer& vulkanRenderer, VkPhysicalDevice physicalDevice, const glm::uvec2& size, uint32_t mipLevels, VkFormat format);
65
66 VkDevice device;
67
68 VkFormat internalFormat;
69 VkImage image;
70 VkDeviceMemory deviceMemory;
71 VkImageView imageView;
72 VkImageLayout currentLayout;
73};
74
75}
A texture.
Definition: Texture.hpp:8
Format
The format of the texture.
Definition: Texture.hpp:18
Type
The type of texture.
Definition: Texture.hpp:11
Low-level renderer implementing Vulkan.
Definition: VulkanRenderer.hpp:24
Vulkan implementation of Texture.
Definition: VulkanTexture.hpp:13
VkImage GetImage() const
Get the image.
Definition: VulkanTexture.cpp:170
VkImageLayout GetImageLayout() const
Get the current image layout.
Definition: VulkanTexture.cpp:178
VulkanTexture(VulkanRenderer &vulkanRenderer, VkDevice device, VkPhysicalDevice physicalDevice, const glm::uvec2 size, Texture::Type type, Texture::Format format, int components=0, unsigned char *data=nullptr)
Create new Vulkan texture.
Definition: VulkanTexture.cpp:12
VkImageView GetImageView() const
Get image view.
Definition: VulkanTexture.cpp:174
void SetImageLayout(VkImageLayout layout)
Set the current image layout.
Definition: VulkanTexture.cpp:182
VkFormat GetFormat() const
Get the format of the texture.
Definition: VulkanTexture.cpp:166
~VulkanTexture() final
Destructor.
Definition: VulkanTexture.cpp:160
Definition: Editor.hpp:18