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:
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 
42 
43  void PrepareResources();
44 
45  void BuildCommandBuffer(VkCommandBuffer t_commandBuffer);
46 
47  void UpdateUniforms();
48 
50  {
51  glm::vec2 scale;
52  glm::vec2 translate;
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 
78 
79  VkRenderPass m_GlobalRenderPass = VK_NULL_HANDLE;
80  };
81 } // namespace Fling
VkPipelineLayout m_pipelineLayout
Definition: ImGuiSubpass.h:61
struct Fling::ImGuiSubpass::PushConstBlock pushConstBlock
void Draw(CommandBuffer &t_CmdBuf, VkFramebuffer t_PresentFrameBuf, UINT32 t_ActiveFrameInFlight, entt::registry &t_reg, float DeltaTime) override
Definition: ImGuiSubpass.cpp:71
INT32 m_indexCount
Definition: ImGuiSubpass.h:77
VkDescriptorPool m_descriptorPool
Definition: ImGuiSubpass.h:58
VkPipeline m_pipeLine
Definition: ImGuiSubpass.h:62
A subpass represents one part of a RenderPipeline.
Definition: Subpass.h:25
void PrepareAttachments() override
Add any attachments to a frame buffer that this subpass may need.
Definition: ImGuiSubpass.cpp:164
Base class that represents a window to the Fling Engine.
Definition: FlingWindow.h:27
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
std::unique_ptr< class Buffer > m_vertexBuffer
Definition: ImGuiSubpass.h:55
void CreateGraphicsPipeline() override
Definition: ImGuiSubpass.cpp:169
Definition: ImGuiSubpass.h:13
glm::vec2 scale
Definition: ImGuiSubpass.h:51
VkSampler m_sampler
Definition: ImGuiSubpass.h:71
Encapsulates functionality of a Vulkan Command buffer.
Definition: CommandBuffer.h:17
A logical device represents the application view of the device.
Definition: LogicalDevice.h:13
VkDeviceMemory m_fontMemory
Definition: ImGuiSubpass.h:68
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
void BuildCommandBuffer(VkCommandBuffer t_commandBuffer)
Definition: ImGuiSubpass.cpp:87
INT32 m_vertexCount
Definition: ImGuiSubpass.h:76
std::shared_ptr< Fling::BaseEditor > m_Editor
Instance of the editor that we will get what commands to build from.
Definition: ImGuiSubpass.h:74
void CleanUp(entt::registry &t_reg) override
Cleanup any allocated resources that you may need a registry for.
Definition: ImGuiSubpass.cpp:415
VkDescriptorSetLayout m_descriptorSetLayout
Definition: ImGuiSubpass.h:59
VkDescriptorSet m_descriptorSet
Definition: ImGuiSubpass.h:64
Represents a swap chain that can be used throughout the program.
Definition: SwapChain.h:21
VkImage m_fontImage
Definition: ImGuiSubpass.h:69
VkPipelineCache m_pipelineCache
Definition: ImGuiSubpass.h:60
int32_t INT32
Definition: FlingTypes.h:18
virtual ~ImGuiSubpass()
Definition: ImGuiSubpass.cpp:54
std::unique_ptr< class Buffer > m_indexBuffer
Definition: ImGuiSubpass.h:56
VkRenderPass m_GlobalRenderPass
Definition: ImGuiSubpass.h:79
void PrepareResources()
Definition: ImGuiSubpass.cpp:435
Definition: ImGuiSubpass.h:49
void UpdateUniforms()
Definition: ImGuiSubpass.cpp:442
glm::vec2 translate
Definition: ImGuiSubpass.h:52
VkImageView m_fontImageView
Definition: ImGuiSubpass.h:70
uint32_t UINT32
Definition: FlingTypes.h:13
Definition: Engine.h:29
void PrepImGuiStyleSettings()
Definition: ImGuiSubpass.cpp:420
FlingWindow * m_Window
Definition: ImGuiSubpass.h:66