Toast Engine
Loading...
Searching...
No Matches
world_ui_pass.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <array>
11#include <glm/glm.hpp>
12#include <toast/renderer/render_pass_base.hpp>
13#include <toast/renderer/shader_layout.hpp>
14#include <toast/renderer/vulkan_common.hpp>
15#include <toast/renderer/vulkan_pipeline.hpp>
16#include <vector>
17
18namespace renderer {
19class VulkanCore;
20}
21
22namespace ui {
23
24class WorldUIPass : public IRenderPass {
25public:
28 enum class Layer : uint8_t {
29 world,
30 overlay,
31 };
32
34 const renderer::VulkanCore& core, vk::Format color_format, vk::Format depth_format, vk::Extent2D extent,
35 Layer layer = Layer::world
36 );
37
38 [[nodiscard]]
39 auto name() const -> std::string_view override {
40 return m_layer == Layer::world ? "World UI" : "World UI (always on top)";
41 }
42
43 [[nodiscard]]
44 auto stage() const -> RenderStage override {
45 return m_layer == Layer::world ? RenderStage::world : RenderStage::overlay;
46 }
47
48 void recordPre(vk::CommandBuffer cmd, uint32_t frame_index, uint32_t image_index) override;
49 void record(vk::CommandBuffer cmd, uint32_t frame_index, uint32_t image_index) override;
50
51private:
52 struct PushConstants {
53 glm::mat4 model;
54 };
55
56 const renderer::VulkanCore* m_core = nullptr;
57 Layer m_layer = Layer::world;
58
59 vk::raii::Sampler m_sampler = nullptr;
60 renderer::ShaderLayout m_shader_layout;
61 renderer::VulkanPipeline m_pipeline;
62
63 std::vector<vk::raii::DescriptorSet> m_frame_camera_sets;
64
65 std::array<std::vector<vk::raii::DescriptorSet>, 3> m_panel_sets;
66 uint32_t m_draw_count = 0;
67};
68
69}
Definition render_pass_base.hpp:19
Definition vulkan_core.hpp:48
Definition world_ui_pass.hpp:24
Layer
Definition world_ui_pass.hpp:28
void recordPre(vk::CommandBuffer cmd, uint32_t frame_index, uint32_t image_index) override
Records outside any rendering scope before the main scope opens.
Definition world_ui_pass.cpp:84