SpiecsEngine
 
Loading...
Searching...
No Matches
ViewportGridRenderer.cpp
Go to the documentation of this file.
1/**
2* @file ViewportGridRenderer.cpp.
3* @brief The ViewportGridRenderer Class Implementation.
4* @author Spices.
5*/
6
7#include "Pchheader.h"
9
10namespace Spices {
11
13 {
15
16 RendererPassBuilder{ "ViewportGrid", this }
17 .AddSubPass("ViewportGrid")
18 .AddColorAttachment("SceneColor", TextureType::Texture2D, [](bool& isEnableBlend, VkAttachmentDescription& description) {
19 isEnableBlend = true;
20 description.format = VK_FORMAT_R16G16B16A16_SFLOAT;
21 })
22 .AddDepthAttachment("Depth", TextureType::Texture2D, [](VkAttachmentDescription& description) {})
25 }
26
28 {
30
31 DescriptorSetBuilder{ "ViewportGrid", this }
32 .AddPushConstant(sizeof(uint64_t))
33 .Build();
34 }
35
37 std::shared_ptr<Material> material ,
38 VkPipelineLayout& layout ,
39 std::shared_ptr<RendererSubPass> subPass
40 )
41 {
43
44 PipelineBuilder{ subPass, material, this }
45 .SetDefault()
46 .NullBindingDescriptions()
47 .NullAttributeDescriptions()
48 .SetRenderPass()
49 .SetSubPassIndex()
50 .SetPipelineLayout(layout)
51 .SetCullMode(VK_CULL_MODE_NONE)
52 .SetColorAttachments()
53 .Build();
54 }
55
57 {
59
60 RenderBehaveBuilder builder{ this ,frameInfo.m_FrameIndex, frameInfo.m_ImageIndex };
61
62 builder.BeginRenderPass();
63
64 builder.BindDescriptorSet(DescriptorSetManager::GetByName("PreRenderer"));
65
66 builder.BindDescriptorSet(DescriptorSetManager::GetByName({ m_Pass->GetName(), "ViewportGrid" }));
67
68 builder.BindPipeline("ViewportGridRenderer.ViewportGrid.Default");
69
70 builder.UpdatePushConstant<uint64_t>([&](auto& push) {
71 push = GetDefaultMaterial("ViewportGrid")->GetMaterialParamsAddress();
72 });
73
74 builder.DrawFullScreenTriangle();
75
76 builder.EndRenderPass();
77 }
78}
#define SPICES_PROFILE_ZONE
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
Material Class. This class contains a branch of parameter and shader, also descriptor.
Definition Material.h:62
This Class Combines some data relative to sub pass. Usually as a member variable of RendererPass.
DescriptorSetBuilder & AddPushConstant(uint32_t size)
Set VkPushConstantRange by a specific push constant struct.
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.
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
virtual void CreateDescriptorSet() override
The interface is inherited from Renderer. Create specific descriptor set for sub pass.
virtual void Render(TimeStep &ts, FrameInfo &frameInfo) override
The interface is inherited from Renderer.
virtual void CreateRendererPass() override
The interface is inherited from Renderer. Create specific render pass.
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.
ViewportGridRenderer Class. This class defines ViewportGrid render behaves.
TextureType
The enum of all Texture Type.
Definition Texture.h:20