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#include <libsbx/graphics/resource_storage.hpp>
11
12#include <libsbx/graphics/images/image.hpp>
13
14namespace sbx::graphics {
15
16class image2d : public image {
17
18public:
19
20 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);
21
22 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);
23
24 image2d(const math::vector2u& extent, VkFormat format, memory::observer_ptr<const std::uint8_t> pixels);
25
26 ~image2d() override = default;
27
28 auto set_pixels(memory::observer_ptr<const std::uint8_t> pixels) -> void;
29
30private:
31
32 auto _load() -> void;
33
34 bool _anisotropic;
35 bool _mipmap;
36 std::uint8_t _channels;
37 std::filesystem::path _path;
38
39}; // class image2d
40
42
43} // namespace sbx::graphics
44
45#endif // LIBSBX_GRAPHICS_IMAGES_IMAGE2D_HPP_
Definition: image2d.hpp:16
Definition: image.hpp:20
Definition: resource_storage.hpp:17
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