Add Image rendering support for ImGui

- Fix alpha channel bug being set to 0
This commit is contained in:
Thraix
2023-07-13 21:17:42 +02:00
parent cb120ef731
commit f9fb74ba6a
7 changed files with 83 additions and 34 deletions
+7 -1
View File
@@ -93,6 +93,7 @@ namespace Copium
const WindowResizeEvent& windowResizeEvent = static_cast<const WindowResizeEvent&>(event);
AssetManager::GetAsset<Framebuffer>(framebuffer).Resize(windowResizeEvent.GetWidth(), windowResizeEvent.GetHeight());
descriptorSetPassthrough->SetSampler(AssetManager::GetAsset<Framebuffer>(framebuffer).GetColorAttachment(), 0);
descriptorSetImGui->SetSampler(AssetManager::GetAsset<Framebuffer>(framebuffer).GetColorAttachment(), 0);
return EventResult::Continue;
}
@@ -146,6 +147,9 @@ namespace Copium
descriptorSetPassthrough = AssetManager::GetAsset<Pipeline>(graphicsPipelinePassthrough).CreateDescriptorSet(*descriptorPool, 0);
descriptorSetPassthrough->SetSampler(AssetManager::GetAsset<Framebuffer>(framebuffer).GetColorAttachment(), 0);
descriptorSetImGui = Vulkan::GetImGuiInstance().CreateDescriptorSet();
descriptorSetImGui->SetSampler(AssetManager::GetAsset<Framebuffer>(framebuffer).GetColorAttachment(), 0);
}
void Application::InitializeGraphicsPipeline()
@@ -168,8 +172,10 @@ namespace Copium
void Application::RecordCommandBuffer()
{
Vulkan::GetImGuiInstance().Begin();
ImGui::ShowDemoWindow();
commandBuffer->Begin();
ImGui::Begin("Viewport");
ImGui::Image(*descriptorSetImGui, ImVec2{480, 270}, ImVec2{0, 1}, ImVec2{1, 0});
ImGui::End();
Framebuffer& fb = AssetManager::GetAsset<Framebuffer>(framebuffer);
Pipeline& pl = AssetManager::GetAsset<Pipeline>(graphicsPipeline);