Commit before change, diverging from vkguide to add a viewport
This commit is contained in:
parent
fe7f7521d8
commit
46d150ac1d
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -1,3 +1,4 @@
|
|||||||
[submodule "src/imgui"]
|
[submodule "src/imgui"]
|
||||||
path = src/imgui
|
path = src/imgui
|
||||||
url = https://github.com/ocornut/imgui.git
|
url = https://github.com/ocornut/imgui.git
|
||||||
|
branch = docking
|
||||||
|
|||||||
11
ROADMAP.md
Normal file
11
ROADMAP.md
Normal 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
|
||||||
@ -279,24 +279,6 @@ void Engine::cleanup() {
|
|||||||
vkb::destroy_debug_utils_messenger(_instance, _debugMessenger);
|
vkb::destroy_debug_utils_messenger(_instance, _debugMessenger);
|
||||||
vkDestroyInstance(_instance, nullptr);
|
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)
|
// Destroy the window (at the end)
|
||||||
glfwDestroyWindow(window);
|
glfwDestroyWindow(window);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
@ -1137,6 +1119,14 @@ void Engine::initImgui() {
|
|||||||
// Init IMGUI
|
// Init IMGUI
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
|
|
||||||
|
// Config
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
// Docking
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
// Viewports
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||||
|
|
||||||
|
// Init backends
|
||||||
ImGui_ImplGlfw_InitForVulkan(
|
ImGui_ImplGlfw_InitForVulkan(
|
||||||
window,
|
window,
|
||||||
true
|
true
|
||||||
@ -1165,6 +1155,8 @@ void Engine::initImgui() {
|
|||||||
|
|
||||||
_mainDeletionQueue.pushFunction([this, imguiPool]() {
|
_mainDeletionQueue.pushFunction([this, imguiPool]() {
|
||||||
ImGui_ImplVulkan_Shutdown();
|
ImGui_ImplVulkan_Shutdown();
|
||||||
|
ImGui_ImplGlfw_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
vkDestroyDescriptorPool(
|
vkDestroyDescriptorPool(
|
||||||
_device,
|
_device,
|
||||||
imguiPool,
|
imguiPool,
|
||||||
@ -1227,6 +1219,8 @@ void Engine::buildImgui() {
|
|||||||
ImGui_ImplVulkan_NewFrame();
|
ImGui_ImplVulkan_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
// Docking
|
||||||
|
ImGui::DockSpaceOverViewport(); // Fullscreen dockspace
|
||||||
|
|
||||||
// Main ImGui things
|
// Main ImGui things
|
||||||
ImGui::ShowDemoWindow();
|
ImGui::ShowDemoWindow();
|
||||||
@ -1246,7 +1240,6 @@ void Engine::buildImgui() {
|
|||||||
backgroundEffects.size() - 1
|
backgroundEffects.size() - 1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
ImGui::InputFloat4(
|
ImGui::InputFloat4(
|
||||||
"data1",
|
"data1",
|
||||||
(float*)& selected.data.data1
|
(float*)& selected.data.data1
|
||||||
@ -1266,6 +1259,19 @@ void Engine::buildImgui() {
|
|||||||
}
|
}
|
||||||
ImGui::End();
|
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
|
// Finish everything
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
}
|
}
|
||||||
@ -1516,7 +1522,5 @@ void Engine::resizeSwapchain() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -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
|
#define ENGINE_IMPL
|
||||||
#include "engine/engine.h"
|
#include "engine/engine.h"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user