diff --git a/CMakeLists.txt b/CMakeLists.txt index 20c192da47..c73f31f0f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ message(STATUS "Generating OpenSpace project") set(OPENSPACE_VERSION_MAJOR 0) set(OPENSPACE_VERSION_MINOR 11) -set(OPENSPACE_VERSION_PATCH 0) +set(OPENSPACE_VERSION_PATCH 1) set(OPENSPACE_VERSION_STRING "Beta-1") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") diff --git a/ext/ghoul b/ext/ghoul index c8d02417ef..96d695afba 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c8d02417ef2bb16887e94adea8c82ab38716e7ec +Subproject commit 96d695afba4cf8c06f11d64377228c7d665c3cee diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 386da78ffd..33d40baead 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -72,8 +72,21 @@ namespace scripting { class ScriptScheduler; } // namespace scripting + // Structure that is responsible for the delayed shutdown of the application +struct ShutdownInformation { + // Whether the application is currently in shutdown mode (i.e. counting down the + // timer and closing it at '0' + bool inShutdown; + // Total amount of time the application will wait before actually shutting down + float waitTime; + // Current state of the countdown; if it reaches '0', the application will + // close + float timer; +}; + class OpenSpaceEngine { public: + static void create(int argc, char** argv, std::unique_ptr windowWrapper, std::vector& sgctArguments, @@ -249,17 +262,7 @@ private: std::vector> mouseScrollWheel; } _moduleCallbacks; - // Structure that is responsible for the delayed shutdown of the application - struct { - // Whether the application is currently in shutdown mode (i.e. counting down the - // timer and closing it at '0' - bool inShutdown; - // Total amount of time the application will wait before actually shutting down - float waitTime; - // Current state of the countdown; if it reaches '0', the application will - // close - float timer; - } _shutdown; + ShutdownInformation _shutdown; // The first frame might take some more time in the update loop, so we need to know to // disable the synchronization; otherwise a hardware sync will kill us after 1 minute diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 6433da0aeb..c25600c091 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -53,6 +53,7 @@ class Scene; class SceneManager; class ScreenLog; class ScreenSpaceRenderable; +struct ShutdownInformation; class Syncable; class SyncBuffer; @@ -90,11 +91,7 @@ public: void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix); - void renderScreenLog(); - void renderVersionInformation(); - void renderCameraInformation(); - void renderShutdownInformation(float timer, float fullTime); - void renderDashboard(); + void renderOverlays(const ShutdownInformation& shutdownInfo); void postDraw(); // Performance measurements @@ -174,6 +171,13 @@ private: void setRenderer(std::unique_ptr renderer); RendererImplementation rendererFromString(const std::string& method) const; + void renderScreenLog(); + void renderVersionInformation(); + void renderCameraInformation(); + void renderShutdownInformation(float timer, float fullTime); + void renderDashboard(); + + Camera* _camera; Scene* _scene; std::unique_ptr _raycasterManager; @@ -188,6 +192,7 @@ private: ghoul::Dictionary _resolveData; ScreenLog* _log; + properties::BoolProperty _showOverlayOnSlaves; properties::BoolProperty _showLog; properties::BoolProperty _showVersionInfo; properties::BoolProperty _showCameraInfo; diff --git a/modules/imgui/src/guiglobebrowsingcomponent.cpp b/modules/imgui/src/guiglobebrowsingcomponent.cpp index 88c868f911..b752529318 100644 --- a/modules/imgui/src/guiglobebrowsingcomponent.cpp +++ b/modules/imgui/src/guiglobebrowsingcomponent.cpp @@ -39,9 +39,8 @@ #include #include -#include - #include +#include #include @@ -70,8 +69,7 @@ void GuiGlobeBrowsingComponent::render() { ImGui::Begin("Globe Browsing", &e, WindowSize, 0.5f); _isEnabled = e; _isCollapsed = ImGui::IsWindowCollapsed(); - OnExit([]() {ImGui::End(); }); // We escape early from this function in a few places - + defer { ImGui::End(); }; // Render the list of planets std::vector nodes = diff --git a/modules/space/shaders/star_vs.glsl b/modules/space/shaders/star_vs.glsl index ed6ff8d193..7ff61c0f5e 100644 --- a/modules/space/shaders/star_vs.glsl +++ b/modules/space/shaders/star_vs.glsl @@ -52,7 +52,7 @@ void main() { vec4 position = pscTransform(tmp, mat4(1.0)); // G-Buffer - vs_gPosition = position; + vs_gPosition = view * (vec4(1E19, 1E19, 1E19, 1.0) * position); position = view * position; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 59c5b1a435..2581fa3ec2 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -72,7 +72,6 @@ #include #include -#include #include #include #include @@ -80,6 +79,7 @@ #include #include #include +#include #include #include @@ -636,12 +636,10 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { windowWrapper().setBarrier(false); windowWrapper().setSynchronization(false); - OnExit( - [this]() { - windowWrapper().setSynchronization(true); - windowWrapper().setBarrier(true); - } - ); + defer { + windowWrapper().setSynchronization(true); + windowWrapper().setBarrier(true); + }; if (assetPath == "") { return; @@ -1349,13 +1347,9 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, perf = std::make_unique( "OpenSpaceEngine::render", OsEng.renderEngine().performanceManager() - ); + ); } - OnExit([] { - LTRACE("OpenSpaceEngine::render(end)"); - }); - const bool isGuiWindow = _windowWrapper->hasGuiWindow() ? _windowWrapper->isGuiWindow() : true; if (isGuiWindow) { @@ -1368,46 +1362,33 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, func(); } - + LTRACE("OpenSpaceEngine::render(end)"); } void OpenSpaceEngine::drawOverlays() { LTRACE("OpenSpaceEngine::drawOverlays(begin)"); - OnExit([] { - LTRACE("OpenSpaceEngine::drawOverlays(end)"); - }); std::unique_ptr perf; if (OsEng.renderEngine().performanceManager()) { perf = std::make_unique( "OpenSpaceEngine::drawOverlays", OsEng.renderEngine().performanceManager() - ); + ); } const bool isGuiWindow = _windowWrapper->hasGuiWindow() ? _windowWrapper->isGuiWindow() : true; if (isGuiWindow) { - _renderEngine->renderScreenLog(); - _renderEngine->renderVersionInformation(); - _renderEngine->renderDashboard(); - - if (!_shutdown.inShutdown) { - // We render the camera information in the same location as the shutdown info - // and we won't need this if we are shutting down - _renderEngine->renderCameraInformation(); - } - else { - // If we are in shutdown mode, we can display the remaining time - _renderEngine->renderShutdownInformation(_shutdown.timer, _shutdown.waitTime); - } + _renderEngine->renderOverlays(_shutdown); _console->render(); } for (const auto& func : _moduleCallbacks.draw2D) { func(); } + + LTRACE("OpenSpaceEngine::drawOverlays(end)"); } void OpenSpaceEngine::postDraw() { @@ -1418,7 +1399,7 @@ void OpenSpaceEngine::postDraw() { perf = std::make_unique( "OpenSpaceEngine::postDraw", OsEng.renderEngine().performanceManager() - ); + ); } _renderEngine->postDraw(); diff --git a/src/performance/performancemanager.cpp b/src/performance/performancemanager.cpp index 69b67f7cf3..c8aa7093e5 100644 --- a/src/performance/performancemanager.cpp +++ b/src/performance/performancemanager.cpp @@ -28,8 +28,8 @@ #include #include +#include #include -#include #include #include @@ -142,7 +142,9 @@ PerformanceManager::PerformanceManager(std::string loggingDirectory, std::string ghoul::SharedMemory sharedMemory(GlobalSharedMemoryName); sharedMemory.acquireLock(); - OnExit([&](){sharedMemory.releaseLock();}); + defer { + sharedMemory.releaseLock(); + }; GlobalMemory* m = reinterpret_cast(sharedMemory.memory()); diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 3527e261fa..538fc2df7b 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -116,6 +116,13 @@ namespace { "example)." }; + static const openspace::properties::Property::PropertyInfo ShowOverlaySlavesInfo = { + "ShowOverlayOnSlaves", + "Show Overlay Information on Slaves", + "If this value is enabled, the overlay information text is also automatically " + "rendered on the slave nodes. This values is disabled by default." + }; + static const openspace::properties::Property::PropertyInfo ShowLogInfo = { "ShowLog", "Show the on-screen log", @@ -226,6 +233,7 @@ RenderEngine::RenderEngine() , _renderer(nullptr) , _rendererImplementation(RendererImplementation::Invalid) , _log(nullptr) + , _showOverlayOnSlaves(ShowOverlaySlavesInfo, false) , _showLog(ShowLogInfo, true) , _showVersionInfo(ShowVersionInfo, true) , _showCameraInfo(ShowCameraInfo, true) @@ -276,6 +284,7 @@ RenderEngine::RenderEngine() }); addProperty(_doPerformanceMeasurements); + addProperty(_showOverlayOnSlaves); addProperty(_showLog); addProperty(_showVersionInfo); addProperty(_showCameraInfo); @@ -602,6 +611,25 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat LTRACE("RenderEngine::render(end)"); } +void RenderEngine::renderOverlays(const ShutdownInformation& info) { + const bool isMaster = OsEng.windowWrapper().isMaster(); + if (isMaster || _showOverlayOnSlaves) { + renderScreenLog(); + renderVersionInformation(); + renderDashboard(); + + if (!info.inShutdown) { + // We render the camera information in the same location as the shutdown info + // and we won't need this if we are shutting down + renderCameraInformation(); + } + else { + // If we are in shutdown mode, we can display the remaining time + renderShutdownInformation(info.timer, info.waitTime); + } + } +} + void RenderEngine::renderShutdownInformation(float timer, float fullTime) { timer = timer < 0.f ? 0.f : timer; diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index f4dbb8fc37..97f35d7bcf 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -250,9 +250,9 @@ bool AssetLoader::loadAsset(std::shared_ptr asset) { std::shared_ptr parentAsset = _currentAsset; setCurrentAsset(asset); - ghoul::OnScopeExit e([this, parentAsset] { + defer { setCurrentAsset(parentAsset); - }); + }; if (!FileSys.fileExists(asset->assetFilePath())) { LERROR("Could not load asset '" << asset->assetFilePath() << diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index fc41935d2e..b53e3247bb 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index 25bfeea128..1d3050f0b9 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -313,6 +313,7 @@ int property_getValue(lua_State* L) { SCRIPT_CHECK_ARGUMENTS("property_getValue", L, 1, nArguments); std::string uri = luaL_checkstring(L, -1); + lua_settop(L, 0); openspace::properties::Property* prop = property(uri); if (!prop) { diff --git a/src/util/taskloader.cpp b/src/util/taskloader.cpp index fb3ddfdd0d..1278b6b9f5 100644 --- a/src/util/taskloader.cpp +++ b/src/util/taskloader.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include