imgui docking
This commit is contained in:
37
imgui.ini
37
imgui.ini
@@ -1,37 +0,0 @@
|
||||
[Window][Preview]
|
||||
Pos=8,34
|
||||
Size=499,677
|
||||
Collapsed=0
|
||||
DockId=0x00000001,0
|
||||
|
||||
[Window][Render]
|
||||
Pos=509,34
|
||||
Size=763,677
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][main]
|
||||
Pos=0,0
|
||||
Size=1280,720
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Inferno HART]
|
||||
Pos=60,60
|
||||
Size=338,222
|
||||
Collapsed=0
|
||||
|
||||
[Window][Dear ImGui Demo]
|
||||
Pos=650,20
|
||||
Size=550,680
|
||||
Collapsed=0
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x9498A894 Window=0xBF28CD64 Pos=8,34 Size=1264,677 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x9498A894 SizeRef=499,1000 Selected=0x382916D5
|
||||
DockNode ID=0x00000002 Parent=0x9498A894 SizeRef=499,1000 CentralNode=1 Selected=0x81AED595
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace inferno::graphics {
|
||||
|
||||
RenderTarget* rendertarget_create(
|
||||
GraphicsDevice* device, VkExtent2D extent, VkFormat format)
|
||||
GraphicsDevice* device, VkExtent2D extent, VkFormat format, bool depth)
|
||||
{
|
||||
RenderTarget* target = new RenderTarget();
|
||||
target->Device = device;
|
||||
|
||||
@@ -29,7 +29,7 @@ typedef struct RenderTarget {
|
||||
GraphicsDevice* Device;
|
||||
} RenderTarget;
|
||||
|
||||
RenderTarget* rendertarget_create(GraphicsDevice* device, VkExtent2D extent, VkFormat format);
|
||||
RenderTarget* rendertarget_create(GraphicsDevice* device, VkExtent2D extent, VkFormat format, bool depth);
|
||||
void rendertarget_cleanup(RenderTarget* target);
|
||||
|
||||
void rendertarget_create_depth(RenderTarget* target);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "graphics.hpp"
|
||||
#include "style.hpp"
|
||||
|
||||
#include "graphics/device.hpp"
|
||||
#include "graphics/swapchain.hpp"
|
||||
@@ -47,6 +48,9 @@ inline void imgui_init(graphics::VulkanRenderer* renderer)
|
||||
// this initializes the core structures of imgui
|
||||
ImGui::CreateContext();
|
||||
|
||||
auto& io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
|
||||
ImGui_ImplGlfw_InitForVulkan(graphics::window_get_glfw_window(), true);
|
||||
|
||||
// this initializes imgui for Vulkan
|
||||
@@ -63,25 +67,11 @@ inline void imgui_init(graphics::VulkanRenderer* renderer)
|
||||
init_info.ColorAttachmentFormat = renderer->Swap->ImageFormat;
|
||||
ImGui_ImplVulkan_Init(&init_info, VK_NULL_HANDLE);
|
||||
|
||||
SetupImGuiStyle2();
|
||||
|
||||
yolo::info("Initialized ImGUI");
|
||||
}
|
||||
|
||||
inline void imgui_imgui_preset_gui()
|
||||
{
|
||||
ImGuiID dockspace_id = ImGui::GetID("main");
|
||||
ImGui::DockBuilderRemoveNode(dockspace_id); // Clear out existing layout
|
||||
ImGui::DockBuilderAddNode(dockspace_id, ImGuiDockNodeFlags_DockSpace); // Add empty
|
||||
// node ImGui::DockBuilderSetNodeSize(dockspace_id, { 1000, 1000 });
|
||||
ImGuiID dock_main_id = dockspace_id;
|
||||
ImGuiID dock_left = ImGui::DockBuilderSplitNode(
|
||||
dock_main_id, ImGuiDir_Left, 0.5f, NULL, &dock_main_id);
|
||||
// ImGui::DockBuilderDockWindow("Preview", dock_left);
|
||||
// ImGui::DockBuilderDockWindow("Render", dock_main_id);
|
||||
ImGui::DockBuilderFinish(dockspace_id);
|
||||
|
||||
yolo::info("LAYOUT SET TO DEFAULT");
|
||||
}
|
||||
|
||||
inline void imgui_new_frame()
|
||||
{
|
||||
ImGui_ImplVulkan_NewFrame();
|
||||
@@ -92,13 +82,10 @@ inline void imgui_new_frame()
|
||||
|
||||
ImGui::SetWindowPos({ 0, 0 });
|
||||
ImGui::SetWindowSize(
|
||||
{ graphics::window_get_size().x, graphics::window_get_size().y });
|
||||
{ graphics::window_get_size().x, graphics::window_get_size().y });
|
||||
|
||||
ImGuiID dockspace_id = ImGui::GetID("main");
|
||||
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
|
||||
// if (ImGui::DockBuilderGetNode(dockspace_id) == NULL) {
|
||||
// imgui_imgui_preset_gui();
|
||||
// }
|
||||
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
|
||||
}
|
||||
|
||||
@@ -119,3 +106,4 @@ inline void imgui_shutdown()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <graphics.hpp>
|
||||
|
||||
namespace inferno {
|
||||
namespace inferno::gui {
|
||||
|
||||
inline void SetupImGuiStyle2()
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ InfernoApp* inferno_create()
|
||||
graphics::renderer_configure_gui(app->Renderer);
|
||||
|
||||
app->PreviewTarget = graphics::rendertarget_create(
|
||||
app->Device, { 1920, 1080 }, VK_FORMAT_R8G8B8A8_UNORM);
|
||||
app->Device, { 1920, 1080 }, VK_FORMAT_R8G8B8A8_UNORM, true);
|
||||
|
||||
graphics::renderer_submit_repeat(
|
||||
app->Renderer,
|
||||
|
||||
Reference in New Issue
Block a user