minecraftvulkan/engine/xe_image.hpp

38 lines
929 B
C++
Raw Normal View History

2022-09-21 02:02:58 +00:00
#pragma once
#include "xe_device.hpp"
#include <string>
namespace xe {
2022-09-25 01:16:13 +00:00
class Image {
2022-09-21 02:02:58 +00:00
public:
2022-09-25 01:16:13 +00:00
Image(Device &xeDevice, const std::string &filename);
~Image();
2022-09-21 02:02:58 +00:00
2022-09-25 01:16:13 +00:00
Image(const Image&) = delete;
Image operator=(const Image&) = delete;
2022-09-21 02:02:58 +00:00
private:
void createTextureImage(const std::string &filename);
void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory);
void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout);
void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height);
2022-09-21 03:04:33 +00:00
void createTextureImageView();
2022-09-21 02:02:58 +00:00
2022-09-25 01:16:13 +00:00
Device &xeDevice;
2022-09-21 02:02:58 +00:00
VkImage textureImage;
2022-09-21 03:04:33 +00:00
VkImageView textureImageView;
2022-09-21 02:02:58 +00:00
VkDeviceMemory textureImageMemory;
2022-09-25 01:16:13 +00:00
friend class RenderSystem;
2022-09-21 02:02:58 +00:00
};
}