2#ifndef LIBSBX_SCENES_SKYBOX_SUBRENDERER_HPP_
3#define LIBSBX_SCENES_SKYBOX_SUBRENDERER_HPP_
5#include <libsbx/graphics/subrenderer.hpp>
7#include <libsbx/graphics/images/cube_image.hpp>
9#include <libsbx/graphics/pipeline/graphics_pipeline.hpp>
10#include <libsbx/graphics/pipeline/vertex_input_description.hpp>
11#include <libsbx/graphics/pipeline/mesh.hpp>
13#include <libsbx/graphics/descriptor/descriptor_handler.hpp>
15#include <libsbx/graphics/buffers/uniform_handler.hpp>
17#include <libsbx/assets/assets_module.hpp>
19#include <libsbx/scenes/components/skybox.hpp>
20#include <libsbx/scenes/components/camera.hpp>
22namespace sbx::scenes {
32 mesh(std::vector<vertex3d>&& vertices, std::vector<std::uint32_t>&& indices)
35 ~mesh()
override =
default;
44 .depth = graphics::depth::read_only,
45 .compare_operation = graphics::compare_operation::less_or_equal,
46 .uses_transparency =
false,
48 .polygon_mode = graphics::polygon_mode::fill,
49 .cull_mode = graphics::cull_mode::none,
50 .front_face = graphics::front_face::counter_clockwise
58 pipeline(
const std::filesystem::path& path,
const std::vector<graphics::attachment_description>& attachments)
59 : base_type{path, attachments, pipeline_definition} { }
61 ~pipeline()
override =
default;
67 skybox_subrenderer(
const std::vector<graphics::attachment_description>& attachments,
const std::filesystem::path& path)
69 _pipeline{path, attachments},
70 _descriptor_handler{_pipeline, 0u},
71 _push_handler{_pipeline} { }
76 auto& assets_module = core::engine::get_module<assets::assets_module>();
77 auto& graphics_module = core::engine::get_module<graphics::graphics_module>();
78 auto&
scenes_module = core::engine::get_module<scenes::scenes_module>();
81 const auto camera_node =
scene.camera();
84 utility::logger<
"scenes">::warn(
"Skybox subrenderer: No camera node with skybox component found");
90 _pipeline.bind(command_buffer);
92 _descriptor_handler.push(
"scene",
scene.uniform_handler());
95 _push_handler.push(
"tint",
skybox.tint);
97 if (!_descriptor_handler.update(_pipeline)) {
101 _descriptor_handler.bind_descriptors(command_buffer);
102 _push_handler.bind(command_buffer);
104 command_buffer.draw(3u, 1u, 0u, 0u);
Definition: command_buffer.hpp:15
Definition: cube_image.hpp:21
Definition: descriptor_handler.hpp:26
Definition: graphics_pipeline.hpp:113
Definition: push_handler.hpp:18
Definition: subrenderer.hpp:14
Definition: vector3.hpp:23
Definition: skybox_subrenderer.hpp:28
Definition: scenes_module.hpp:21
Definition: skybox_subrenderer.hpp:39
Definition: logger.hpp:124
Definition: graphics_pipeline.hpp:104
Definition: graphics_pipeline.hpp:65
Definition: skybox.hpp:13
Definition: skybox_subrenderer.hpp:24