2022-09-21 02:02:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "xe_device.hpp"
|
|
|
|
|
|
|
|
#include <string>
|
2022-09-28 13:38:25 +00:00
|
|
|
#include <set>
|
2022-09-21 02:02:58 +00:00
|
|
|
|
|
|
|
namespace xe {
|
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
class Image {
|
2022-09-21 02:02:58 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2022-09-28 13:38:25 +00:00
|
|
|
static Image* createImage(const std::string &filename, bool anisotropic);
|
|
|
|
static void deleteImage(Image* image);
|
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
~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:
|
|
|
|
|
2022-09-28 13:38:25 +00:00
|
|
|
static void submitDeleteQueue(bool purge);
|
|
|
|
|
|
|
|
Image(const std::string &filename, bool anisotropic);
|
|
|
|
|
2022-09-21 02:02:58 +00:00
|
|
|
void createTextureImage(const std::string &filename);
|
|
|
|
void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout);
|
2022-09-26 03:08:03 +00:00
|
|
|
void generateMipmaps(VkImage image, VkFormat imageFormat, int32_t texWidth, int32_t texHeight, uint32_t mipLevels);
|
2022-09-21 02:02:58 +00:00
|
|
|
void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height);
|
2022-09-21 03:04:33 +00:00
|
|
|
void createTextureImageView();
|
2022-09-27 03:34:05 +00:00
|
|
|
void createTextureSampler(bool anisotropic);
|
2022-09-21 02:02:58 +00:00
|
|
|
|
2022-09-26 04:06:51 +00:00
|
|
|
static void createImage(Device& device, uint32_t width, uint32_t height, uint32_t mipLevels, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory);
|
|
|
|
static VkImageView createImageView(Device& device, VkImage image, VkFormat format, VkImageAspectFlags aspectFlags, uint32_t mipLevels);
|
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
Device &xeDevice;
|
2022-09-21 02:02:58 +00:00
|
|
|
|
2022-09-26 03:08:03 +00:00
|
|
|
uint32_t mipLevels;
|
|
|
|
VkSampler textureSampler;
|
2022-09-26 04:06:51 +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-26 04:06:51 +00:00
|
|
|
friend class SwapChain;
|
2022-09-28 13:38:25 +00:00
|
|
|
friend class Engine;
|
2022-09-21 02:02:58 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|