sandbox
Loading...
Searching...
No Matches
image2d.hpp
1#ifndef LIBSBX_GRAPHICS_IMAGES_IMAGE2D_HPP_
2#define LIBSBX_GRAPHICS_IMAGES_IMAGE2D_HPP_
3
4#include <filesystem>
5
6#include <libsbx/memory/observer_ptr.hpp>
7
8#include <libsbx/math/vector2.hpp>
9
10
11#include <libsbx/graphics/images/image.hpp>
12
13namespace sbx::graphics {
14
15class image2d : public image {
16
17public:
18
19 image2d(const math::vector2u& extent, VkFormat format = VK_FORMAT_R8G8B8A8_UNORM, VkImageLayout layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VkImageUsageFlags usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_STORAGE_BIT, VkFilter filter = VK_FILTER_LINEAR, VkSamplerAddressMode address_mode = VK_SAMPLER_ADDRESS_MODE_REPEAT, VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT, bool anisotropic = false, bool mipmap = false);
20
21 image2d(const std::filesystem::path& path, VkFilter filter = VK_FILTER_LINEAR, VkSamplerAddressMode address_mode = VK_SAMPLER_ADDRESS_MODE_REPEAT, bool anisotropic = false, bool mipmap = false);
22
23 image2d(const math::vector2u& extent, VkFormat format , memory::observer_ptr<const std::uint8_t> pixels);
24
25 ~image2d() override = default;
26
27 auto set_pixels(memory::observer_ptr<const std::uint8_t> pixels) -> void;
28
29private:
30
31 auto _load() -> void;
32
33 bool _anisotropic;
34 bool _mipmap;
35 std::uint8_t _channels;
36 std::filesystem::path _path;
37
38}; // class image2d
39
40} // namespace sbx::graphics
41
42#endif // LIBSBX_GRAPHICS_IMAGES_IMAGE2D_HPP_
Definition: image2d.hpp:15
Definition: image.hpp:18
A vector in two-dimensional space.
Definition: vector2.hpp:27
A non-owning pointer that can be used to observe the value of a pointer.
Definition: observer_ptr.hpp:27