mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 22:39:09 -05:00
Merge remote-tracking branch 'origin/master' into issue/501
This commit is contained in:
+1
-1
@@ -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}")
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: c8d02417ef...96d695afba
@@ -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> windowWrapper,
|
||||
std::vector<std::string>& sgctArguments,
|
||||
@@ -249,17 +262,7 @@ private:
|
||||
std::vector<std::function<bool (double, double)>> 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
|
||||
|
||||
@@ -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> 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> _raycasterManager;
|
||||
@@ -188,6 +192,7 @@ private:
|
||||
ghoul::Dictionary _resolveData;
|
||||
ScreenLog* _log;
|
||||
|
||||
properties::BoolProperty _showOverlayOnSlaves;
|
||||
properties::BoolProperty _showLog;
|
||||
properties::BoolProperty _showVersionInfo;
|
||||
properties::BoolProperty _showCameraInfo;
|
||||
|
||||
@@ -39,9 +39,8 @@
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/misc/defer.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
@@ -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<SceneGraphNode*> nodes =
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
|
||||
#include <ghoul/ghoul.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
#include <ghoul/cmdparser/commandlineparser.h>
|
||||
#include <ghoul/cmdparser/singlecommand.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
@@ -80,6 +79,7 @@
|
||||
#include <ghoul/font/fontrenderer.h>
|
||||
#include <ghoul/logging/consolelog.h>
|
||||
#include <ghoul/logging/visualstudiooutputlog.h>
|
||||
#include <ghoul/misc/defer.h>
|
||||
#include <ghoul/opengl/debugcontext.h>
|
||||
#include <ghoul/systemcapabilities/systemcapabilities>
|
||||
|
||||
@@ -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<performance::PerformanceMeasurement>(
|
||||
"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<performance::PerformanceMeasurement> perf;
|
||||
if (OsEng.renderEngine().performanceManager()) {
|
||||
perf = std::make_unique<performance::PerformanceMeasurement>(
|
||||
"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<performance::PerformanceMeasurement>(
|
||||
"OpenSpaceEngine::postDraw",
|
||||
OsEng.renderEngine().performanceManager()
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
_renderEngine->postDraw();
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <openspace/performance/performancelayout.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/defer.h>
|
||||
#include <ghoul/misc/sharedmemory.h>
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -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<GlobalMemory*>(sharedMemory.memory());
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <ghoul/lua/luastate.h>
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
#include <ghoul/misc/defer.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
@@ -250,9 +250,9 @@ bool AssetLoader::loadAsset(std::shared_ptr<Asset> asset) {
|
||||
std::shared_ptr<Asset> parentAsset = _currentAsset;
|
||||
|
||||
setCurrentAsset(asset);
|
||||
ghoul::OnScopeExit e([this, parentAsset] {
|
||||
defer {
|
||||
setCurrentAsset(parentAsset);
|
||||
});
|
||||
};
|
||||
|
||||
if (!FileSys.fileExists(asset->assetFilePath())) {
|
||||
LERROR("Could not load asset '" << asset->assetFilePath() <<
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
#include <ghoul/misc/threadpool.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
#include <ghoul/misc/onscopeexit.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
Reference in New Issue
Block a user