Add in shader reloading and cleanup
This commit is contained in:
@@ -15,9 +15,10 @@
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#include "FileBrowser.hpp"
|
||||
#include "engine/debug/DEBUG_NAMES.hpp"
|
||||
#include "engine/descriptors/DescriptorPool.hpp"
|
||||
#include "engine/assets/model/Model.hpp"
|
||||
#include "engine/debug/DEBUG_NAMES.hpp"
|
||||
#include "engine/debug/profiling/counters.hpp"
|
||||
#include "engine/descriptors/DescriptorPool.hpp"
|
||||
#include "engine/rendering/Renderer.hpp"
|
||||
#include "engine/tree/octtree/OctTreeNode.hpp"
|
||||
#include "gui_window_names.hpp"
|
||||
@@ -88,6 +89,11 @@ namespace fgl::engine::gui
|
||||
//ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
|
||||
void endDrawImGui( FrameInfo& info )
|
||||
{
|
||||
endImGui( info.command_buffer );
|
||||
}
|
||||
|
||||
inline void prepareDock( ImGuiID& primary_id )
|
||||
{
|
||||
ImGui::DockBuilderRemoveNode( primary_id );
|
||||
@@ -161,11 +167,15 @@ namespace fgl::engine::gui
|
||||
// ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void drawMainGUI( FrameInfo& info )
|
||||
void startDrawImGui( [[maybe_unused]] FrameInfo& info )
|
||||
{
|
||||
beginImGui();
|
||||
profiling::resetCounters();
|
||||
}
|
||||
|
||||
void drawImGui( FrameInfo& info )
|
||||
{
|
||||
ZoneScoped;
|
||||
beginImGui();
|
||||
|
||||
// ImGui::ShowDemoWindow();
|
||||
|
||||
drawDock();
|
||||
@@ -176,8 +186,6 @@ namespace fgl::engine::gui
|
||||
drawFilesystemGUI( info );
|
||||
|
||||
drawStats( info );
|
||||
|
||||
endImGui( info.command_buffer );
|
||||
}
|
||||
|
||||
static GameObject* selected_object { nullptr };
|
||||
|
||||
@@ -15,10 +15,14 @@ namespace fgl::engine
|
||||
|
||||
namespace fgl::engine::gui
|
||||
{
|
||||
// Setup/Destruction
|
||||
void initGui( const Window& window, const Renderer& renderer );
|
||||
void cleanupImGui();
|
||||
|
||||
void drawMainGUI( FrameInfo& );
|
||||
// Draws
|
||||
void startDrawImGui( FrameInfo& info );
|
||||
|
||||
void drawImGui( FrameInfo& );
|
||||
void drawEntityGUI( FrameInfo& );
|
||||
|
||||
void drawEntityInfo( FrameInfo& );
|
||||
@@ -32,4 +36,6 @@ namespace fgl::engine::gui
|
||||
|
||||
void drawStats( const FrameInfo& info );
|
||||
|
||||
void endDrawImGui( FrameInfo& info );
|
||||
|
||||
} // namespace fgl::engine::gui
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "core.hpp"
|
||||
#include "engine/debug/profiling/counters.hpp"
|
||||
#include "engine/flags.hpp"
|
||||
#include "engine/math/literals/size.hpp"
|
||||
#include "engine/memory/buffers/Buffer.hpp"
|
||||
#include "engine/tree/octtree/OctTreeNode.hpp"
|
||||
@@ -102,9 +103,7 @@ namespace fgl::engine::gui
|
||||
const auto& counters { profiling::getCounters() };
|
||||
ImGui::Text( "Models drawn: %zu", counters.models_draw );
|
||||
ImGui::Text( "Verts drawn: %zu", counters.verts_drawn );
|
||||
|
||||
//TODO: This should likely be moved to the just before we start rendering again.
|
||||
profiling::resetCounters();
|
||||
ImGui::Text( "Draw instances: %zu", counters.instance_count );
|
||||
|
||||
if ( ImGui::CollapsingHeader( "Memory" ) )
|
||||
{
|
||||
@@ -113,6 +112,11 @@ namespace fgl::engine::gui
|
||||
|
||||
imGuiOctTreeSettings( info );
|
||||
|
||||
if ( ImGui::Button( "Reload shaders" ) )
|
||||
{
|
||||
flags::triggerShaderReload();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,10 @@ int main()
|
||||
|
||||
// We start by hooking into the imgui rendering.
|
||||
engine_ctx.hookInitImGui( gui::initGui );
|
||||
engine_ctx.hookCleanupImGui( gui::cleanupImGui );
|
||||
engine_ctx.TEMPhookGuiRender( gui::drawMainGUI );
|
||||
engine_ctx.hookPreFrame( gui::startDrawImGui );
|
||||
engine_ctx.hookEarlyFrame( gui::drawImGui );
|
||||
engine_ctx.hookLateFrame( gui::endDrawImGui );
|
||||
engine_ctx.hookDestruction( gui::cleanupImGui );
|
||||
|
||||
// Now we need to create the camera for the editor.
|
||||
CameraManager& camera_manager { engine_ctx.cameraManager() };
|
||||
@@ -47,9 +49,9 @@ int main()
|
||||
|
||||
// Render step
|
||||
engine_ctx.renderFrame();
|
||||
}
|
||||
|
||||
engine_ctx.run();
|
||||
engine_ctx.finishFrame();
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user