| Fling Engine 0.00.1 Fling Engine is a game engine written in Vulkan

ImGuiSubpass.h
Go to the documentation of this file.
1 #pragma once
2
3 #include "Subpass.h"
4
5 namespace Fling
6 {
7 class CommandBuffer;
8 class LogicalDevice;
9 class Swapchain;
10 class BaseEditor;
11 class FlingWindow;
12
13 class ImGuiSubpass : public Subpass
14 {
15 public:
16 ImGuiSubpass(
17 const LogicalDevice* t_Dev,
18 const Swapchain* t_Swap,
19 entt::registry& t_reg,
20 FlingWindow* t_Window,
21 VkRenderPass t_GlobalRenderPass,
22 std::shared_ptr<Fling::BaseEditor> t_Editor,
23 std::shared_ptr<Fling::Shader> t_Vert,
24 std::shared_ptr<Fling::Shader> t_Frag
25 );
26
27 virtual ~ImGuiSubpass();
28
29 void Draw(CommandBuffer& t_CmdBuf, VkFramebuffer t_PresentFrameBuf, UINT32 t_ActiveFrameInFlight, entt::registry& t_reg, float DeltaTime) override;
30
31 void CreateDescriptorSets(VkDescriptorPool t_Pool, entt::registry& t_reg) override;
32
33 void PrepareAttachments() override;
34
35 void CreateGraphicsPipeline() override;
36
37 void CleanUp(entt::registry& t_reg) override;
38
39 private:
40
41 void PrepImGuiStyleSettings();
42
43 void PrepareResources();
44
45 void BuildCommandBuffer(VkCommandBuffer t_commandBuffer);
46
47 void UpdateUniforms();
48
49 struct PushConstBlock
50 {
51 glm::vec2 scale;
52 glm::vec2 translate;
53 } pushConstBlock;
54
55 std::unique_ptr<class Buffer> m_vertexBuffer;
56 std::unique_ptr<class Buffer> m_indexBuffer;
57
58 VkDescriptorPool m_descriptorPool = VK_NULL_HANDLE;
59 VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE;
60 VkPipelineCache m_pipelineCache = VK_NULL_HANDLE;
61 VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE;
62 VkPipeline m_pipeLine = VK_NULL_HANDLE;
63
64 VkDescriptorSet m_descriptorSet;
65
66 FlingWindow* m_Window = nullptr;
67
68 VkDeviceMemory m_fontMemory = VK_NULL_HANDLE;
69 VkImage m_fontImage = VK_NULL_HANDLE;
70 VkImageView m_fontImageView = VK_NULL_HANDLE;
71 VkSampler m_sampler = VK_NULL_HANDLE;
72
74 std::shared_ptr<Fling::BaseEditor> m_Editor;
75
76 INT32 m_vertexCount = 0;
77 INT32 m_indexCount = 0;
78
79 VkRenderPass m_GlobalRenderPass = VK_NULL_HANDLE;
80 };
81 } // namespace Fling
Fling::ImGuiSubpass::m_pipelineLayout
VkPipelineLayout m_pipelineLayout
Definition: ImGuiSubpass.h:61
Fling::ImGuiSubpass::pushConstBlock
struct Fling::ImGuiSubpass::PushConstBlock pushConstBlock
Fling::ImGuiSubpass::Draw
void Draw(CommandBuffer &t_CmdBuf, VkFramebuffer t_PresentFrameBuf, UINT32 t_ActiveFrameInFlight, entt::registry &t_reg, float DeltaTime) override
Definition: ImGuiSubpass.cpp:71
Fling::ImGuiSubpass::m_indexCount
INT32 m_indexCount
Definition: ImGuiSubpass.h:77
Fling::ImGuiSubpass::m_descriptorPool
VkDescriptorPool m_descriptorPool
Definition: ImGuiSubpass.h:58
Fling::ImGuiSubpass::m_pipeLine
VkPipeline m_pipeLine
Definition: ImGuiSubpass.h:62
Fling::Subpass
A subpass represents one part of a RenderPipeline.
Definition: Subpass.h:25
Fling::ImGuiSubpass::PrepareAttachments
void PrepareAttachments() override
Add any attachments to a frame buffer that this subpass may need.
Definition: ImGuiSubpass.cpp:164
Fling::FlingWindow
Base class that represents a window to the Fling Engine.
Definition: FlingWindow.h:27
Fling::ImGuiSubpass::CreateDescriptorSets
void CreateDescriptorSets(VkDescriptorPool t_Pool, entt::registry &t_reg) override
Given the frame buffers and the registry, create any descriptor sets that we may need Assumes that th...
Definition: ImGuiSubpass.cpp:159
Fling::ImGuiSubpass::m_vertexBuffer
std::unique_ptr< class Buffer > m_vertexBuffer
Definition: ImGuiSubpass.h:55
Fling::ImGuiSubpass::CreateGraphicsPipeline
void CreateGraphicsPipeline() override
Definition: ImGuiSubpass.cpp:169
Fling::ImGuiSubpass
Definition: ImGuiSubpass.h:13
Fling::ImGuiSubpass::PushConstBlock::scale
glm::vec2 scale
Definition: ImGuiSubpass.h:51
Fling::ImGuiSubpass::m_sampler
VkSampler m_sampler
Definition: ImGuiSubpass.h:71
Fling::CommandBuffer
Encapsulates functionality of a Vulkan Command buffer.
Definition: CommandBuffer.h:17
Fling::LogicalDevice
A logical device represents the application view of the device.
Definition: LogicalDevice.h:13
Fling::ImGuiSubpass::m_fontMemory
VkDeviceMemory m_fontMemory
Definition: ImGuiSubpass.h:68
Fling::ImGuiSubpass::ImGuiSubpass
ImGuiSubpass(const LogicalDevice *t_Dev, const Swapchain *t_Swap, entt::registry &t_reg, FlingWindow *t_Window, VkRenderPass t_GlobalRenderPass, std::shared_ptr< Fling::BaseEditor > t_Editor, std::shared_ptr< Fling::Shader > t_Vert, std::shared_ptr< Fling::Shader > t_Frag)
Definition: ImGuiSubpass.cpp:20
Fling::ImGuiSubpass::BuildCommandBuffer
void BuildCommandBuffer(VkCommandBuffer t_commandBuffer)
Definition: ImGuiSubpass.cpp:87
Fling::ImGuiSubpass::m_vertexCount
INT32 m_vertexCount
Definition: ImGuiSubpass.h:76
Fling::ImGuiSubpass::m_Editor
std::shared_ptr< Fling::BaseEditor > m_Editor
Instance of the editor that we will get what commands to build from.
Definition: ImGuiSubpass.h:74
Fling::ImGuiSubpass::CleanUp
void CleanUp(entt::registry &t_reg) override
Cleanup any allocated resources that you may need a registry for.
Definition: ImGuiSubpass.cpp:415
Fling::ImGuiSubpass::m_descriptorSetLayout
VkDescriptorSetLayout m_descriptorSetLayout
Definition: ImGuiSubpass.h:59
Fling::ImGuiSubpass::m_descriptorSet
VkDescriptorSet m_descriptorSet
Definition: ImGuiSubpass.h:64
Fling::Swapchain
Represents a swap chain that can be used throughout the program.
Definition: SwapChain.h:21
Fling::ImGuiSubpass::m_fontImage
VkImage m_fontImage
Definition: ImGuiSubpass.h:69
Fling::ImGuiSubpass::m_pipelineCache
VkPipelineCache m_pipelineCache
Definition: ImGuiSubpass.h:60
INT32
int32_t INT32
Definition: FlingTypes.h:18
Fling::ImGuiSubpass::~ImGuiSubpass
virtual ~ImGuiSubpass()
Definition: ImGuiSubpass.cpp:54
Fling::ImGuiSubpass::m_indexBuffer
std::unique_ptr< class Buffer > m_indexBuffer
Definition: ImGuiSubpass.h:56
Subpass.h
Fling::ImGuiSubpass::m_GlobalRenderPass
VkRenderPass m_GlobalRenderPass
Definition: ImGuiSubpass.h:79
Fling::ImGuiSubpass::PrepareResources
void PrepareResources()
Definition: ImGuiSubpass.cpp:435
Fling::ImGuiSubpass::PushConstBlock
Definition: ImGuiSubpass.h:49
Fling::ImGuiSubpass::UpdateUniforms
void UpdateUniforms()
Definition: ImGuiSubpass.cpp:442
Fling::ImGuiSubpass::PushConstBlock::translate
glm::vec2 translate
Definition: ImGuiSubpass.h:52
Fling::ImGuiSubpass::m_fontImageView
VkImageView m_fontImageView
Definition: ImGuiSubpass.h:70
UINT32
uint32_t UINT32
Definition: FlingTypes.h:13
Fling
Definition: Engine.h:29
Fling::ImGuiSubpass::PrepImGuiStyleSettings
void PrepImGuiStyleSettings()
Definition: ImGuiSubpass.cpp:420
Fling::ImGuiSubpass::m_Window
FlingWindow * m_Window
Definition: ImGuiSubpass.h:66