2#ifndef LIBSBX_SCENES_GRID_SUBRENDERER_HPP_
3#define LIBSBX_SCENES_GRID_SUBRENDERER_HPP_
5#include <libsbx/math/vector4.hpp>
8#include <libsbx/graphics/subrenderer.hpp>
9#include <libsbx/graphics/pipeline/graphics_pipeline.hpp>
10#include <libsbx/graphics/buffers/push_handler.hpp>
11#include <libsbx/graphics/buffers/storage_handler.hpp>
12#include <libsbx/graphics/descriptor/descriptor_handler.hpp>
14namespace sbx::scenes {
19 .depth = sbx::graphics::depth::read_only,
20 .uses_transparency =
true,
22 .polygon_mode = sbx::graphics::polygon_mode::fill,
23 .cull_mode = sbx::graphics::cull_mode::none,
24 .front_face = sbx::graphics::front_face::counter_clockwise
28 inline static constexpr auto default_shader_path = std::string_view{
"engine://shaders/grid"};
32 grid_subrenderer(
const std::vector<graphics::attachment_description>& attachments,
const std::filesystem::path& path = default_shader_path)
34 _pipeline{path, attachments, pipeline_definition},
35 _push_handler{_pipeline},
36 _descriptor_handler{_pipeline, 0u} { }
43 EASY_BLOCK(
"grid_subrenderer::render");
45 auto&
scenes_module = sbx::core::engine::get_module<sbx::scenes::scenes_module>();
47 auto& environment =
scene.environment();
48 auto& graph =
scene.graph();
50 _pipeline.bind(command_buffer);
52 _push_handler.push(
"origin", sbx::math::vector4::zero);
54 _descriptor_handler.push(
"scene", environment.uniform_handler());
56 if (!_descriptor_handler.update(_pipeline)) {
60 _descriptor_handler.bind_descriptors(command_buffer);
61 _push_handler.bind(command_buffer);
63 command_buffer.draw(6u, 1u, 0u, 0u);
Definition: command_buffer.hpp:15
Definition: descriptor_handler.hpp:26
Definition: graphics_pipeline.hpp:115
Definition: push_handler.hpp:18
Definition: subrenderer.hpp:14
Definition: grid_subrenderer.hpp:16
Definition: scenes_module.hpp:26
RGBA color representation and utilities.
Definition: graphics_pipeline.hpp:106
Definition: graphics_pipeline.hpp:67