VOX
A little voxel engine
Loading...
Searching...
No Matches
Image.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "vk_define.hpp"
4#include "Command.hpp"
6
7#include <string>
8#include <vector>
9
10class Image
11{
12
13public:
14
16 {
17 VkExtent2D extent;
18 VkImageAspectFlags aspect_mask = VK_IMAGE_ASPECT_COLOR_BIT;
19 uint32_t mip_levels = 1;
20 uint32_t array_layers = 1;
21
22 VkFormat format;
23 VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL;
24
25 VkImageUsageFlags usage;
26 VkMemoryPropertyFlags memory_properties;
27
28 std::vector<std::string> file_paths = {};
29
30 VkImageLayout final_layout;
31
32 bool create_view = false;
33
34 bool create_sampler = false;
35 VkFilter sampler_filter = VK_FILTER_LINEAR;
36 VkSamplerAddressMode sampler_address_mode = VK_SAMPLER_ADDRESS_MODE_REPEAT;
37 VkBool32 sampler_anisotropy_enable = VK_TRUE;
38
39 bool is_cube_map = false;
40 };
41
42 Image();
43
44 Image(const Image &) = delete;
45 Image & operator=(const Image &) = delete;
46
47 Image(Image && other) noexcept;
48 Image & operator=(Image && other) noexcept;
49
50 ~Image();
51
52 Image(
53 VkDevice device,
54 VkPhysicalDevice physical_device,
55 SingleTimeCommand & command_buffer,
56 const CreateInfo & create_info
57 );
58
60 VkCommandBuffer command_buffer,
61 VkImageLayout old_layout,
62 VkImageLayout new_layout,
63 VkPipelineStageFlags src_stage = VK_PIPELINE_STAGE_NONE,
64 VkPipelineStageFlags dst_stage = VK_PIPELINE_STAGE_NONE
65 );
66
67 void clear();
68
69 VkImage image;
70 VkDeviceMemory memory;
71 VkImageView view;
72 VkSampler sampler;
73
74 VkFormat format;
75 VkExtent2D extent2D;
76 VkExtent3D extent3D;
77 VkImageAspectFlags aspect_mask;
78 uint32_t mip_levels;
79 uint32_t array_layers;
80
81private:
82
83 VkDevice m_device;
84 VkPhysicalDevice m_physical_device;
85
86};
Definition: Image.hpp:11
~Image()
Definition: Image.cpp:71
VkExtent3D extent3D
Definition: Image.hpp:76
VkSampler sampler
Definition: Image.hpp:72
Image(const Image &)=delete
VkFormat format
Definition: Image.hpp:74
void clear()
Definition: Image.cpp:654
Image & operator=(const Image &)=delete
Image()
Definition: Image.cpp:14
uint32_t array_layers
Definition: Image.hpp:79
uint32_t mip_levels
Definition: Image.hpp:78
VkImageAspectFlags aspect_mask
Definition: Image.hpp:77
VkExtent2D extent2D
Definition: Image.hpp:75
void transitionLayout(VkCommandBuffer command_buffer, VkImageLayout old_layout, VkImageLayout new_layout, VkPipelineStageFlags src_stage=VK_PIPELINE_STAGE_NONE, VkPipelineStageFlags dst_stage=VK_PIPELINE_STAGE_NONE)
Definition: Image.cpp:520
VkImageView view
Definition: Image.hpp:71
VkDeviceMemory memory
Definition: Image.hpp:70
VkImage image
Definition: Image.hpp:69
Definition: Command.hpp:8
Definition: Image.hpp:16
VkFilter sampler_filter
Definition: Image.hpp:35
VkImageTiling tiling
Definition: Image.hpp:23
VkImageLayout final_layout
Definition: Image.hpp:30
std::vector< std::string > file_paths
Definition: Image.hpp:28
uint32_t mip_levels
Definition: Image.hpp:19
VkMemoryPropertyFlags memory_properties
Definition: Image.hpp:26
bool create_view
Definition: Image.hpp:32
VkImageAspectFlags aspect_mask
Definition: Image.hpp:18
uint32_t array_layers
Definition: Image.hpp:20
bool create_sampler
Definition: Image.hpp:34
VkBool32 sampler_anisotropy_enable
Definition: Image.hpp:37
VkImageUsageFlags usage
Definition: Image.hpp:25
VkFormat format
Definition: Image.hpp:22
VkSamplerAddressMode sampler_address_mode
Definition: Image.hpp:36
VkExtent2D extent
Definition: Image.hpp:17
bool is_cube_map
Definition: Image.hpp:39