diff --git a/.gitmodules b/.gitmodules index add20bf..c4cdd73 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "src/imgui"] path = src/imgui url = https://github.com/ocornut/imgui.git + branch = docking diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 0000000..b9c3e38 --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,11 @@ +# Roadmap + +Finish vkguide.dev + +Rewrite some part, for structure purposes + +Configure offscreen rendering for imgui (docked viewport) + +Separate tooling and core, for shipping +- #ifdef DEBUG for tools +- #ifdef NDEBUG for release diff --git a/src/Engine/engine/engine.h b/src/Engine/engine/engine.h index c8e2abe..97ab0c4 100644 --- a/src/Engine/engine/engine.h +++ b/src/Engine/engine/engine.h @@ -279,24 +279,6 @@ void Engine::cleanup() { vkb::destroy_debug_utils_messenger(_instance, _debugMessenger); vkDestroyInstance(_instance, nullptr); - /* - - vkDestroyCommandPool(_device, _commandPool, nullptr); - - - - vkDestroySwapchainKHR(_device, _swapchain, nullptr); - // Change to use dynamic rendering - vkDestroyRenderPass(_device, _renderPass, nullptr); - - // Destroy swapchain ressources - for (uint32_t i = 0; i < _framebuffers.size(); i++) { - vkDestroyFramebuffer(_device, _framebuffers[i], nullptr); - - vkDestroyImageView(_device, _swapchainImageViews[i], nullptr); - } - */ - // Destroy the window (at the end) glfwDestroyWindow(window); glfwTerminate(); @@ -1137,6 +1119,14 @@ void Engine::initImgui() { // Init IMGUI ImGui::CreateContext(); + // Config + ImGuiIO& io = ImGui::GetIO(); + // Docking + io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; + // Viewports + io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; + + // Init backends ImGui_ImplGlfw_InitForVulkan( window, true @@ -1165,6 +1155,8 @@ void Engine::initImgui() { _mainDeletionQueue.pushFunction([this, imguiPool]() { ImGui_ImplVulkan_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); vkDestroyDescriptorPool( _device, imguiPool, @@ -1227,6 +1219,8 @@ void Engine::buildImgui() { ImGui_ImplVulkan_NewFrame(); ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); + // Docking + ImGui::DockSpaceOverViewport(); // Fullscreen dockspace // Main ImGui things ImGui::ShowDemoWindow(); @@ -1246,7 +1240,6 @@ void Engine::buildImgui() { backgroundEffects.size() - 1 ); - ImGui::InputFloat4( "data1", (float*)& selected.data.data1 @@ -1266,6 +1259,19 @@ void Engine::buildImgui() { } ImGui::End(); + + if (ImGui::Begin("Viewport")) { + // Debug info + #ifdef DEBUG + ImVec2 avail = ImGui::GetWindowSize(); + float width = avail.x; + float height = avail.y; + //println("[Engine:Info] Available size : \nx: {}\ny: {}", width, height ); + #endif + } + ImGui::End(); + + // Finish everything ImGui::Render(); } @@ -1516,7 +1522,5 @@ void Engine::resizeSwapchain() { #endif } - - #endif #endif diff --git a/src/Engine/main.cpp b/src/Engine/main.cpp index bd0db34..d8903dd 100644 --- a/src/Engine/main.cpp +++ b/src/Engine/main.cpp @@ -1,3 +1,9 @@ +/* +Copyright Alexandre Delcamp-Enache, 2026 +Based on vkguide.dev +See engine.h for extensive documentation +Also, checkout the roadmap +*/ #define ENGINE_IMPL #include "engine/engine.h"