SpiecsEngine
 
Loading...
Searching...
No Matches
SlateRenderer.h
Go to the documentation of this file.
1/**
2* @file SlateRenderer.h.
3* @brief The SlateRenderer Class Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9#include "Render/Renderer/Renderer.h"
10
11namespace Spices {
12
13 /**
14 * @brief SlateRenderer Class.
15 * This class defines the imgui render behaves.
16 */
17 class SlateRenderer : public Renderer
18 {
19 public:
20
21 /**
22 * @brief Constructor Function.
23 * Init member variables.
24 * @param[in] rendererName The name of this Renderer.
25 * @param[in] vulkanState The core vulkan objects that in use.
26 * @param[in] descriptorPool The DescriptorPool.
27 * @param[in] device The VulkanDevice, used for format query.
28 * @param[in] rendererResourcePool The RendererResourcePool, RT Pool.
29 */
31 const std::string& rendererName ,
32 VulkanState& vulkanState ,
33 const std::shared_ptr<VulkanDescriptorPool>& descriptorPool ,
34 const std::shared_ptr<VulkanDevice>& device ,
35 const std::shared_ptr<RendererResourcePool>& rendererResourcePool
36 );
37
38 /**
39 * @brief Destructor Function.
40 */
41 virtual ~SlateRenderer() override { ShutdownImgui(); }
42
43 /**
44 * @brief The interface is inherited from Renderer.
45 * @param[in] ts TimeStep.
46 * @param[in] frameInfo The current frame data.
47 */
48 virtual void Render(TimeStep& ts, FrameInfo& frameInfo) override;
49
50 /**
51 * @brief Get slate material pipeline.
52 * @param[in] name material name.
53 * @return Returns material pipeline.
54 */
55 static std::shared_ptr<VulkanPipeline> GetPipeline(const std::string& name);
56
57 private:
58
59 /**
60 * @brief The interface is inherited from Renderer.
61 * Create specific render pass.
62 */
63 virtual void CreateRendererPass() override;
64
65 /**
66 * @brief The interface is inherited from Renderer.
67 * Create specific descriptor set for sub pass.
68 */
69 virtual void CreateDescriptorSet() override;
70
71 /**
72 * @brief The interface is inherited from Renderer.
73 * Create Material Specific Pipeline.
74 * @param[in] material Registry material.
75 * @param[in] layout VkPipelineLayout.
76 * @param[in] subPass Handled subPass.
77 */
78 virtual void CreatePipeline(
79 std::shared_ptr<Material> material ,
80 VkPipelineLayout& layout ,
81 std::shared_ptr<RendererSubPass> subPass
82 ) override;
83
84 /**
85 * @brief Rewrite Renderer OnSystemInitialize to add other code.
86 */
87 virtual void OnSystemInitialize() override;
88
89 /**
90 * @brief This interface is called on Window resized over (registry by swapchain).
91 * If the specific renderer uses swapchain image attachment during CreateRenderPass(),
92 * this interface needs to override, callOnSlateResize here just will be fine.
93 */
94 virtual void OnWindowResizeOver() override;
95
96 private:
97
98 /**
99 * @brief Init Imgui.
100 */
101 void InitImgui() const;
102
103 /**
104 * @brief Shutdown Imgui.
105 */
106 void ShutdownImgui();
107
108 /**
109 * @brief Begin Imgui frame.
110 */
111 void BeginImguiFrame();
112
113 /**
114 * @brief End Imgui frame.
115 * @param[in] index CommandBuffer index.
116 */
117 void EndImguiFrame(uint32_t index) const;
118
119 /**
120 * @brief End Imgui frame.
121 * @param[in] index CommandBuffer index.
122 */
123 void EndImguiFrameAsync(uint32_t index);
124 };
125}
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
This Class manages all descriptor sets this project.
uint32_t m_FrameIndex
FrameIndex, varying during 0 - (MaxFrameInFlight - 1). Used almost anywhere.
Definition FrameInfo.h:69
uint32_t m_ImageIndex
ImageIndex, varying during 0 - (MaxFrameInFlight - 1). Used in swapchain index and framebuffer index.
Definition FrameInfo.h:75
FrameInfo Class. This class defines the FrameInfo data.
Definition FrameInfo.h:32
static void SetFonts(FontMode fontmode=FontMode::FONT_PROPORTIONAL_SCALED)
Looking for TTF fonts, first on the VULKAN SDK, then Windows default fonts.
static void SetStyle()
Setting common style across samples.
static void MainDockSpace(Side side=Side::Scene, float alpha=1.0f)
Begin a docking space.
The ImGuiH Class. This class defines helper function for slate render.
Definition ImguiHelper.h:61
Material Class. This class contains a branch of parameter and shader, also descriptor.
Definition Material.h:62
RendererResourcePool Class. This class is a pool of all framebuffer's attachment.
This Class Combines some data relative to sub pass. Usually as a member variable of RendererPass.
virtual void BeginRenderPass()
Begin this Renderer's RenderPass.
Definition Renderer.cpp:840
virtual void EndRenderPass()
End this Renderer's RenderPass.
Definition Renderer.cpp:981
This class helps to bind pipeline and bind buffer. Only instanced during Render().
Definition Renderer.h:985
RendererPassBuilder & EndSubPass()
End recording a sub pass.
void Build() const
Build the RendererPass.
RendererPassBuilder & AddSubPass(const std::string &subPassName, Querier::StatisticsFlags flags=Querier::ALL)
Add a new SubPass to Renderer Pass.
virtual void OnSlateResize()
Definition Renderer.cpp:66
Renderer(const std::string &rendererName, VulkanState &vulkanState, const std::shared_ptr< VulkanDescriptorPool > &DescriptorPool, const std::shared_ptr< VulkanDevice > &device, const std::shared_ptr< RendererResourcePool > &rendererResourcePool, bool isLoadDefaultMaterial=true)
Constructor Function. Init member variables.
Definition Renderer.cpp:16
DescriptorSetManager::DescriptorSetCombineFlags m_DescriptorSetCombine
Combination of DescriptorSet.
Definition Renderer.h:2027
virtual void OnSystemInitialize()
This interface is called on render system is registered. Initialize the specific renderer's pipeline,...
Definition Renderer.cpp:38
VulkanState & m_VulkanState
This variable is passed while renderer instanced.
Definition Renderer.h:1992
Renderer Class. This class defines the basic behaves of renderer. When we add an new Renderer,...
Definition Renderer.h:57
void InitImgui() const
Init Imgui.
virtual void OnWindowResizeOver() override
This interface is called on Window resized over (registry by swapchain). If the specific renderer use...
virtual void CreatePipeline(std::shared_ptr< Material > material, VkPipelineLayout &layout, std::shared_ptr< RendererSubPass > subPass) override
The interface is inherited from Renderer. Create Material Specific Pipeline.
void BeginImguiFrame()
Begin Imgui frame.
virtual void CreateRendererPass() override
The interface is inherited from Renderer. Create specific render pass.
SlateRenderer(const std::string &rendererName, VulkanState &vulkanState, const std::shared_ptr< VulkanDescriptorPool > &descriptorPool, const std::shared_ptr< VulkanDevice > &device, const std::shared_ptr< RendererResourcePool > &rendererResourcePool)
Constructor Function. Init member variables.
virtual ~SlateRenderer() override
Destructor Function.
virtual void OnSystemInitialize() override
Rewrite Renderer OnSystemInitialize to add other code.
void ShutdownImgui()
Shutdown Imgui.
virtual void CreateDescriptorSet() override
The interface is inherited from Renderer. Create specific descriptor set for sub pass.
void EndImguiFrame(uint32_t index) const
End Imgui frame.
virtual void Render(TimeStep &ts, FrameInfo &frameInfo) override
The interface is inherited from Renderer.
static std::shared_ptr< VulkanPipeline > GetPipeline(const std::string &name)
Get slate material pipeline.
void EndImguiFrameAsync(uint32_t index)
End Imgui frame.
SlateRenderer Class. This class defines the imgui render behaves.
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
VulkanDescriptorPool Class. This class is the wrapper of VkDescriptorPool.
VulkanInstance Class. This class defines the VulkanDevice behave. This class is just a wrapper of vkd...
This class is a wrapper of VkPipelineLayout and VkPipeline.
Thread safe unordered_map.
static scl::thread_unordered_map< std::string, std::shared_ptr< VulkanPipeline > > * m_SlatePipelinesPtr
This struct contains all Vulkan object in used global.
Definition VulkanUtils.h:74