Commit before change, diverging from vkguide to add a viewport

This commit is contained in:
Alexandre 2026-08-13 18:44:54 +02:00
parent fe7f7521d8
commit 46d150ac1d
4 changed files with 43 additions and 21 deletions

1
.gitmodules vendored
View File

@ -1,3 +1,4 @@
[submodule "src/imgui"]
path = src/imgui
url = https://github.com/ocornut/imgui.git
branch = docking

11
ROADMAP.md Normal file
View File

@ -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

View File

@ -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

View File

@ -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"