From c47f54992fa237259d07ead44097ad24128b1090 Mon Sep 17 00:00:00 2001 From: redstrate <54911369+redstrate@users.noreply.github.com> Date: Sun, 18 Apr 2021 21:38:57 -0400 Subject: [PATCH] Add flag for apps like an editor who doesn't render any scene in the main window. --- engine/core/include/app.hpp | 2 ++ engine/core/src/engine.cpp | 2 +- tools/common/include/commoneditor.hpp | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/core/include/app.hpp b/engine/core/include/app.hpp index 670dc1a..9e78a26 100755 --- a/engine/core/include/app.hpp +++ b/engine/core/include/app.hpp @@ -26,6 +26,8 @@ public: virtual void update([[maybe_unused]] const float delta_time) {} virtual void render([[maybe_unused]] GFXCommandBuffer* command_buffer) {} + + virtual bool wants_no_scene_rendering() { return false; } }; /// This is an app's equivalent main(). You can check command line arguments through Engine::comand_line_arguments. diff --git a/engine/core/src/engine.cpp b/engine/core/src/engine.cpp index c4a46bf..457f87e 100755 --- a/engine/core/src/engine.cpp +++ b/engine/core/src/engine.cpp @@ -769,7 +769,7 @@ void Engine::render(const int index) { } if(_renderer != nullptr) - _renderer->render(commandbuffer, _current_scene, *window->render_target, index); + _renderer->render(commandbuffer, _app->wants_no_scene_rendering() ? nullptr : _current_scene, *window->render_target, index); _gfx->submit(commandbuffer, index); } diff --git a/tools/common/include/commoneditor.hpp b/tools/common/include/commoneditor.hpp index 3f2dbcb..5365653 100755 --- a/tools/common/include/commoneditor.hpp +++ b/tools/common/include/commoneditor.hpp @@ -128,6 +128,8 @@ public: virtual void object_selected([[maybe_unused]] Object object) {} virtual void asset_selected([[maybe_unused]] std::filesystem::path path, [[maybe_unused]] AssetType type) {} + bool wants_no_scene_rendering() override { return true; } + void createDockArea(); void drawViewport(Scene* scene); void drawAssets();