SimpleGL  1.1.0
A framework for platform independent rendering
texture_image.hpp
Go to the documentation of this file.
1 
8 #ifndef TEXTURE_IMAGE_HPP
9 #define TEXTURE_IMAGE_HPP
10 
11 #include <SimpleGL_vk/SimpleGL_vk_Export.h>
12 
13 #include <vector>
14 
15 #include <vulkan/vulkan.h>
16 
17 namespace sgl {
18 
24  class SIMPLEGL_VK_EXPORT TextureImage {
25 
26  private:
28  static TextureImage* current;
29 
31  VkImage handle;
32 
34  VkDeviceMemory memory;
35 
37  VkImageView imageView;
38 
40  VkSampler textureSampler;
41 
43  uint32_t width;
44 
46  uint32_t height;
47 
54  void perfomImageLayoutTransition(VkImageLayout oldLayout, VkImageLayout newLayout);
55 
62  void copyBufferToImage(VkBuffer buffer, VkImage image);
63 
64  public:
70  static TextureImage* getCurrent();
71 
77  static void setCurrent(TextureImage* current);
78 
85  TextureImage(uint32_t width, uint32_t height);
86 
88  ~TextureImage(void);
89 
95  VkImage getHandle();
96 
102  VkImageView getImageView();
103 
109  VkSampler getSampler();
110 
116  uint32_t getWidth();
117 
123  uint32_t getHeight();
124 
130  void upload(std::vector<uint8_t> data);
131  };
132 }
133 
134 #endif /* TEXTURE_IMAGE_HPP */
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
This class wraps a Vulkan texture image.