SpiecsEngine
 
Loading...
Searching...
No Matches
ImguiVirtualGeometryVisualizer.cpp
Go to the documentation of this file.
1/**
2* @file ImguiVirtualGeometryVisualizer.cpp.
3* @brief The ImguiVirtualGeometryVisualizer Class Implementation.
4* @author Spices.
5*/
6
7#include "Pchheader.h"
9
10#include "Render/Vulkan/VulkanRenderBackend.h"
11
12namespace Spices {
13
15 const std::string& panelName,
16 FrameInfo& frameInfo
17 )
18 : ImguiSlate(panelName, frameInfo)
19 {
21
23 }
24
26 {
28
29 if (!m_IsSlateOn) return;
30
31 /**
32 * @brief Begin render VirtualGeometry Visualizer.
33 */
34 Begin(m_PanelName.c_str());
35
36 ImVec2 size = { m_Width , m_Height };
37
38 /**
39 * @brief Render TriangleID.
40 */
41 {
42 SPICES_PROFILE_ZONEN("Render TriangleID");
43
44 ImGui::Text("TriangleID");
45 ImGui::Image(m_BufferID.TriangleID, size);
46 ImGui::Separator();
47 }
48
49 /**
50 * @brief Render MeshletID.
51 */
52 {
53 SPICES_PROFILE_ZONEN("Render MeshletID");
54
55 ImGui::Text("MeshletID");
56 ImGui::Image(m_BufferID.MeshletID, size);
57 ImGui::Separator();
58 }
59
60 /**
61 * @brief End render GBuffer Visualizer.
62 */
63 End();
64
65 }
66
68 {
70
71 /**
72 * @brief Instance a EventDispatcher.
73 */
74 EventDispatcher dispatcher(event);
75
76 /**
77 * @brief Dispatch SlateResizeEvent to ImguiGBufferVisualizer::OnSlateResized.
78 */
80 }
81
83 {
85
86 /**
87 * @brief Free old DescriptorSet.
88 */
89 m_BufferID.Free();
90
91 m_Width = 500;
92 m_Height = m_Width * event.GetHeight() / static_cast<float>(event.GetWidth());
93
94 /**
95 * @rief Re Query ID.
96 */
98
99 /**
100 * @brief Do not block the event.
101 */
102 return false;
103 }
104
106 {
108
109 VkDescriptorImageInfo* triangleID = VulkanRenderBackend::GetRendererResourcePool()->AccessResource({ "TriangleID" });
110 VkDescriptorImageInfo* meshletID = VulkanRenderBackend::GetRendererResourcePool()->AccessResource({ "MeshletID" });
111
112 m_BufferID.TriangleID = reinterpret_cast<ImTextureID>(ImGui_ImplVulkan_AddTexture(triangleID->sampler, triangleID->imageView, triangleID->imageLayout));
113 m_BufferID.MeshletID = reinterpret_cast<ImTextureID>(ImGui_ImplVulkan_AddTexture(meshletID->sampler, meshletID->imageView, meshletID->imageLayout));
114 }
115}
#define BIND_EVENT_FN(x)
Bind Event.
Definition Event.h:88
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
EventDispatcher(Event &event)
Constructor Function.
Definition Event.h:172
This Class store a Specific Event type first and Dispatch a event handle function to it.
Definition Event.h:156
This Class is the basic Event Class. Inherit from it and create specific event class.
Definition Event.h:96
FrameInfo Class. This class defines the FrameInfo data.
Definition FrameInfo.h:32
void End()
End a slate.
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
Definition ImguiUtils.h:35
This Class defines the basic behaves of specific slate. When we add an new Slate, we need inherit fro...
Definition ImguiUtils.h:27
bool OnSlateResized(SlateResizeEvent &event)
Event Dispatcher target. Registry on Slate(Viewport) Resized.
ImguiVirtualGeometryVisualizer(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
void QueryID()
Query ID from RendererResourcePool.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
const uint32_t & GetHeight() const
Get New Viewport Height.
Definition SlateEvent.h:46
const uint32_t & GetWidth() const
Get New Viewport Width.
Definition SlateEvent.h:40
This Class is inherited from Event Class. Called by Viewport Resize.
Definition SlateEvent.h:18