2#ifndef LIBSBX_SPRITES_SPRITE_SUBRENDERER_HPP_
3#define LIBSBX_SPRITES_SPRITE_SUBRENDERER_HPP_
5#include <unordered_map>
8#include <magic_enum/magic_enum.hpp>
10#include <libsbx/utility/fast_mod.hpp>
11#include <libsbx/utility/enum.hpp>
13#include <libsbx/core/engine.hpp>
15#include <libsbx/math/vector2.hpp>
16#include <libsbx/math/vector3.hpp>
17#include <libsbx/math/matrix4x4.hpp>
19#include <libsbx/graphics/subrenderer.hpp>
20#include <libsbx/graphics/graphics_module.hpp>
22#include <libsbx/graphics/pipeline/compiler.hpp>
24#include <libsbx/graphics/images/image.hpp>
25#include <libsbx/graphics/images/sampler_state.hpp>
26#include <libsbx/graphics/images/separate_image2d_array.hpp>
27#include <libsbx/graphics/images/depth_image.hpp>
29#include <libsbx/graphics/buffers/push_handler.hpp>
30#include <libsbx/graphics/buffers/uniform_handler.hpp>
32#include <libsbx/graphics/descriptor/descriptor_handler.hpp>
34#include <libsbx/scenes/scenes_module.hpp>
36#include <libsbx/sprites/sprites_module.hpp>
38namespace sbx::sprites {
42 static constexpr auto mode_count = magic_enum::enum_count<sprite_space>();
47 auto operator==(
const pipeline_key& other)
const ->
bool =
default;
50 struct pipeline_key_hash {
51 auto operator()(
const pipeline_key& key)
const -> std::size_t;
54 struct pipeline_data {
63 inline static const auto default_shader_path = std::string_view{
"engine://shaders/sprites"};
67 sprite_subrenderer(
const std::vector<graphics::attachment_description>& attachments,
const std::filesystem::path& path = default_shader_path);
75 auto _get_or_create_pipeline(sprite_space space) -> pipeline_data&;
81 inline static const auto _mode_specializations = std::array<std::string, 3u>{
82 "screen_overlay_mode",
87 std::vector<graphics::attachment_description> _attachments;
88 std::filesystem::path _shader_path;
90 std::unordered_map<pipeline_key, pipeline_data, pipeline_key_hash> _pipeline_cache;
92 std::array<graphics::storage_buffer_handle, mode_count> _sprite_buffers;
Definition: command_buffer.hpp:15
Definition: descriptor_handler.hpp:26
Definition: push_handler.hpp:18
Definition: resource_storage.hpp:18
Definition: sampler_state.hpp:11
Definition: storage_buffer.hpp:17
Definition: subrenderer.hpp:14
Definition: sprite_subrenderer.hpp:40