2#ifndef LIBSBX_GRAPHICS_IMAGES_CUBE_IMAGE_HPP_
3#define LIBSBX_GRAPHICS_IMAGES_CUBE_IMAGE_HPP_
7#include <libsbx/utility/timer.hpp>
9#include <libsbx/math/vector2.hpp>
11#include <libsbx/graphics/images/image.hpp>
13#include <libsbx/graphics/buffers/buffer.hpp>
15#include <libsbx/graphics/resource_storage.hpp>
17#include <libsbx/graphics/images/image2d.hpp>
19namespace sbx::graphics {
25 cube_image(
const std::filesystem::path& path,
const std::string& suffix =
".png", graphics::format format = graphics::format::r8g8b8a8_srgb, VkFilter filter = VK_FILTER_LINEAR, VkSamplerAddressMode address_mode = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
bool anisotropic =
true,
bool mipmap =
true);
27 cube_image(
const math::vector2u& extent, VkFormat format = VK_FORMAT_R8G8B8A8_UNORM, 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_CLAMP_TO_EDGE, VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT,
bool anisotropic =
false,
bool mipmap =
false);
31 auto name()
const noexcept -> std::string
override {
36 auto descriptor_image_infos = std::vector<VkDescriptorImageInfo>{};
38 auto descriptor_image_info = VkDescriptorImageInfo{};
39 descriptor_image_info.imageLayout = (descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
40 descriptor_image_info.imageView = (descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ? _array_view : _view;
41 descriptor_image_info.sampler = _sampler;
43 descriptor_image_infos.push_back(descriptor_image_info);
45 auto descriptor_write = VkWriteDescriptorSet{};
46 descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
47 descriptor_write.dstSet =
nullptr;
48 descriptor_write.dstBinding = binding;
49 descriptor_write.dstArrayElement = 0;
50 descriptor_write.descriptorCount = 1;
51 descriptor_write.descriptorType = descriptor_type;
58 auto _load(
const std::filesystem::path& path = {},
const std::string& suffix = {}) ->
void;
60 inline static constexpr auto side_names = std::array<std::string_view, 6u>{
"right",
"left",
"top",
"bottom",
"front",
"back"};
64 std::uint8_t _channels;
66 VkImageView _array_view;
Definition: cube_image.hpp:21
Definition: resource_storage.hpp:18
Definition: descriptor.hpp:13
A vector in two-dimensional space.
Definition: vector2.hpp:28