From 21d799dd29bdfb3d70d1bada996518ba76f50f99 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 09:31:07 +0200 Subject: [PATCH 01/10] Force an even number of vertices for the RenderableSpheres (closes #957) --- modules/base/rendering/renderablesphericalgrid.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 8fb5c1491b..054c83fa6c 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -137,7 +137,12 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio if (dictionary.hasKey(SegmentsInfo.identifier)) { _segments = static_cast(dictionary.value(SegmentsInfo.identifier)); } - _segments.onChange([&]() { _gridIsDirty = true; }); + _segments.onChange([&]() { + if (_segments.value() % 2 == 1) { + _segments = _segments - 1; + } + _gridIsDirty = true; + }); addProperty(_segments); if (dictionary.hasKey(LineWidthInfo.identifier)) { @@ -259,7 +264,10 @@ void RenderableSphericalGrid::update(const UpdateData&) { _isize = 6 * _segments * _segments; _vsize = (_segments + 1) * (_segments + 1); _varray.resize(_vsize); + Vertex v = { 0.f, 0.f, 0.f }; + std::fill(_varray.begin(), _varray.end(), v); _iarray.resize(_isize); + std::fill(_iarray.begin(), _iarray.end(), 0); int nr = 0; const float fsegments = static_cast(_segments); From 5675a495b076a49785c3f852dba744940ef612b0 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 09:39:01 +0200 Subject: [PATCH 02/10] GCC compile fix --- src/interaction/externinteraction.cpp | 49 ++++++++++++------------- src/interaction/websocketinputstate.cpp | 1 + 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/interaction/externinteraction.cpp b/src/interaction/externinteraction.cpp index 13f6915a34..ab383a67ff 100644 --- a/src/interaction/externinteraction.cpp +++ b/src/interaction/externinteraction.cpp @@ -40,42 +40,39 @@ #include namespace { -const uint32_t ProtocolVersion = 3; -const size_t MaxLatencyDiffs = 64; -const char* _loggerCat = "ExternInteraction"; + constexpr const uint32_t ProtocolVersion = 3; + constexpr const size_t MaxLatencyDiffs = 64; -constexpr openspace::properties::Property::PropertyInfo BufferTimeInfo = { - "BufferTime", - "Buffer Time", - "" // @TODO Missing documentation -}; + constexpr openspace::properties::Property::PropertyInfo BufferTimeInfo = { + "BufferTime", + "Buffer Time", + "" // @TODO Missing documentation + }; -constexpr openspace::properties::Property::PropertyInfo TimeKeyFrameInfo = { - "TimeKeyframeInterval", - "Time keyframe interval", - "" // @TODO Missing documentation -}; + constexpr openspace::properties::Property::PropertyInfo TimeKeyFrameInfo = { + "TimeKeyframeInterval", + "Time keyframe interval", + "" // @TODO Missing documentation + }; -constexpr openspace::properties::Property::PropertyInfo CameraKeyFrameInfo = { - "CameraKeyframeInterval", - "Camera Keyframe interval", - "" // @TODO Missing documentation -}; - -constexpr openspace::properties::Property::PropertyInfo TimeToleranceInfo = { - "TimeTolerance", - "Time tolerance", - "" // @TODO Missing documentation -}; + constexpr openspace::properties::Property::PropertyInfo CameraKeyFrameInfo = { + "CameraKeyframeInterval", + "Camera Keyframe interval", + "" // @TODO Missing documentation + }; + constexpr openspace::properties::Property::PropertyInfo TimeToleranceInfo = { + "TimeTolerance", + "Time tolerance", + "" // @TODO Missing documentation + }; } // namespace namespace openspace { ExternInteraction::ExternInteraction() : properties::PropertyOwner({ "ExternInteration", "External Interaction" }) -{ -} +{} void ExternInteraction::cameraInteraction(datamessagestructures::CameraKeyframe kf) { interaction::KeyframeNavigator::CameraPose pose; diff --git a/src/interaction/websocketinputstate.cpp b/src/interaction/websocketinputstate.cpp index e49989147c..4a531c83bf 100644 --- a/src/interaction/websocketinputstate.cpp +++ b/src/interaction/websocketinputstate.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include From 0f36cf0dd42578d9c927165c0c8b8aaaf2150626 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 09:52:35 +0200 Subject: [PATCH 03/10] Always add transformation property owners, even if the defaults are not overwritten --- src/scene/scenegraphnode.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index 914242cf9a..21b8c06d26 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -123,11 +123,13 @@ std::unique_ptr SceneGraphNode::createFromDictionary( )); return nullptr; } - result->addPropertySubOwner(result->_transform.translation.get()); LDEBUG(fmt::format( "Successfully created ephemeris for '{}'", result->identifier() )); } + if (result->_transform.translation) { + result->addPropertySubOwner(result->_transform.translation.get()); + } if (dictionary.hasKey(KeyTransformRotation)) { ghoul::Dictionary rotationDictionary; @@ -139,11 +141,13 @@ std::unique_ptr SceneGraphNode::createFromDictionary( )); return nullptr; } - result->addPropertySubOwner(result->_transform.rotation.get()); LDEBUG(fmt::format( "Successfully created rotation for '{}'", result->identifier() )); } + if (result->_transform.rotation) { + result->addPropertySubOwner(result->_transform.rotation.get()); + } if (dictionary.hasKey(KeyTransformScale)) { ghoul::Dictionary scaleDictionary; @@ -155,9 +159,11 @@ std::unique_ptr SceneGraphNode::createFromDictionary( )); return nullptr; } - result->addPropertySubOwner(result->_transform.scale.get()); LDEBUG(fmt::format("Successfully created scale for '{}'", result->identifier())); } + if (result->_transform.scale) { + result->addPropertySubOwner(result->_transform.scale.get()); + } if (dictionary.hasKey(KeyTimeFrame)) { ghoul::Dictionary timeFrameDictionary; From 13cb950480310e570127892096b8f623699e0f61 Mon Sep 17 00:00:00 2001 From: Emil Axelsson Date: Thu, 22 Aug 2019 10:27:59 +0200 Subject: [PATCH 04/10] Fix bug with camera following anchor node --- include/openspace/interaction/orbitalnavigator.h | 6 +++--- src/interaction/orbitalnavigator.cpp | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/openspace/interaction/orbitalnavigator.h b/include/openspace/interaction/orbitalnavigator.h index 520608b90a..4ec4ced185 100644 --- a/include/openspace/interaction/orbitalnavigator.h +++ b/include/openspace/interaction/orbitalnavigator.h @@ -83,7 +83,7 @@ public: ScriptCameraStates& scriptStates(); const ScriptCameraStates& scriptStates() const; - bool shouldFollowAnchorRotation() const; + bool shouldFollowAnchorRotation(const glm::dvec3& cameraPosition) const; bool followingAnchorRotation() const; const SceneGraphNode* anchorNode() const; const SceneGraphNode* aimNode() const; @@ -290,8 +290,8 @@ private: /** * Interpolates between rotationDiff and a 0 rotation. */ - glm::dquat interpolateRotationDifferential(double deltaTime, - double interpolationTime, const glm::dquat& rotationDiff); + glm::dquat interpolateRotationDifferential(double deltaTime, double interpolationTime, + const glm::dvec3 cameraPosition, const glm::dquat& rotationDiff); /** * Get the vector from the camera to the surface of the anchor object in world space. diff --git a/src/interaction/orbitalnavigator.cpp b/src/interaction/orbitalnavigator.cpp index ea267548d1..ea817396b4 100644 --- a/src/interaction/orbitalnavigator.cpp +++ b/src/interaction/orbitalnavigator.cpp @@ -369,7 +369,7 @@ void OrbitalNavigator::resetVelocities() { _websocketStates.resetVelocities(); _scriptStates.resetVelocities(); - if (shouldFollowAnchorRotation()) { + if (shouldFollowAnchorRotation(_camera->positionVec3())) { _followRotationInterpolator.end(); } else { @@ -459,6 +459,7 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { anchorNodeRotationDiff = interpolateRotationDifferential( deltaTime, _followRotationInterpolationTime, + pose.position, anchorNodeRotationDiff ); @@ -701,7 +702,8 @@ void OrbitalNavigator::setRetargetInterpolationTime(float durationInSeconds) { _retargetInterpolationTime = durationInSeconds; } -bool OrbitalNavigator::shouldFollowAnchorRotation() const { +bool OrbitalNavigator::shouldFollowAnchorRotation(const glm::dvec3& cameraPosition) const +{ if (!_anchorNode) { return false; } @@ -709,7 +711,7 @@ bool OrbitalNavigator::shouldFollowAnchorRotation() const { const glm::dmat4 modelTransform = _anchorNode->modelTransform(); const glm::dmat4 inverseModelTransform = _anchorNode->inverseModelTransform(); const glm::dvec3 cameraPositionModelSpace = glm::dvec3(inverseModelTransform * - glm::dvec4(_camera->positionVec3(), 1.0)); + glm::dvec4(cameraPosition, 1.0)); const SurfacePositionHandle positionHandle = _anchorNode->calculateSurfacePositionHandle(cameraPositionModelSpace); @@ -719,7 +721,7 @@ bool OrbitalNavigator::shouldFollowAnchorRotation() const { ) * _followAnchorNodeRotationDistance; const double distanceToCamera = - glm::distance(_camera->positionVec3(), _anchorNode->worldPosition()); + glm::distance(cameraPosition, _anchorNode->worldPosition()); return distanceToCamera < maximumDistanceForRotation; } @@ -1277,10 +1279,12 @@ glm::dvec3 OrbitalNavigator::pushToSurface(double minHeightAboveGround, glm::dquat OrbitalNavigator::interpolateRotationDifferential(double deltaTime, double interpolationTime, + const glm::dvec3 cameraPosition, const glm::dquat& rotationDiff) { // Interpolate with a negative delta time if distance is too large to follow - const double interpolationSign = shouldFollowAnchorRotation() ? 1.0 : -1.0; + const double interpolationSign = + shouldFollowAnchorRotation(cameraPosition) ? 1.0 : -1.0; _followRotationInterpolator.setInterpolationTime(static_cast( interpolationTime From 3fd6cd5ae698ae738e7d06aac561460c162fa6f0 Mon Sep 17 00:00:00 2001 From: Emil Axelsson Date: Thu, 22 Aug 2019 13:55:06 +0200 Subject: [PATCH 05/10] Update webgui --- data/assets/util/webgui.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/util/webgui.asset b/data/assets/util/webgui.asset index 29a6437b42..9ecd45606a 100644 --- a/data/assets/util/webgui.asset +++ b/data/assets/util/webgui.asset @@ -3,7 +3,7 @@ asset.require('./static_server') local guiCustomization = asset.require('customization/gui') -- Select which commit hashes to use for the frontend and backend -local frontendHash = "2d1bb8d8d8478b6ed025ccc6f1e0ceacf04b6114" +local frontendHash = "129a2c70ec8179b193fdb3a689c37bd65418ac22" local dataProvider = "data.openspaceproject.com/files/webgui" local frontend = asset.syncedResource({ From d32b4d9f1f0e1653d57c8722d78e34a075d177b7 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 14:34:45 +0200 Subject: [PATCH 06/10] Update Ghoul to fix the commandline parsing (closes #950) --- apps/OpenSpace/main.cpp | 2 +- ext/ghoul | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 87bceea835..1be2584abe 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -1131,7 +1131,7 @@ int main(int argc, char** argv) { "evaluated before it is passed to OpenSpace." )); - // setCommandLine returns a referece to the vector that will be filled later + // setCommandLine returns a reference to the vector that will be filled later const std::vector& sgctArguments = parser.setCommandLine( { argv, argv + argc } ); diff --git a/ext/ghoul b/ext/ghoul index 526b27cb65..e91413398b 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 526b27cb653fe9befc324278debc701297694207 +Subproject commit e91413398bf7a1e2e0f61dfd7edb1656e354945c From 8ce9fde91b3b81663a33574a6bbed5920ccc8674 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 15:37:08 +0200 Subject: [PATCH 07/10] Enable the user to specify a custom temporary folder to keep the OS's temp folder clean Change the configuration file to point the temp folder into the OpenSpace folder Update Ghoul to not overwrite default font files (closes #944) --- ext/ghoul | 2 +- openspace.cfg | 3 ++- src/engine/openspaceengine.cpp | 14 ++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index e91413398b..d73b914734 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit e91413398bf7a1e2e0f61dfd7edb1656e354945c +Subproject commit d73b9147347140932bf0691788183db92ccfaf14 diff --git a/openspace.cfg b/openspace.cfg index d34aae67c9..51b091a9a4 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -78,7 +78,8 @@ Paths = { LOGS = "${BASE}/logs", MODULES = "${BASE}/modules", SCRIPTS = "${BASE}/scripts", - SHADERS = "${BASE}/shaders" + SHADERS = "${BASE}/shaders", + TEMPORARY = "${BASE}/temp" } ModuleConfigurations = { diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 6c2042961e..a204b7e44c 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -104,10 +104,7 @@ namespace openspace { class Scene; -OpenSpaceEngine::OpenSpaceEngine() - : _scene(nullptr) - , _loadingScreen(nullptr) -{ +OpenSpaceEngine::OpenSpaceEngine() { FactoryManager::initialize(); FactoryManager::ref().addFactory( std::make_unique>(), @@ -164,19 +161,20 @@ void OpenSpaceEngine::registerPathTokens() { ghoul::filesystem::FileSystem::TokenClosingBraces; LDEBUG(fmt::format("Registering path {}: {}", fullKey, path.second)); - const bool override = (fullKey == "${BASE}"); - if (override) { + const bool overrideBase = (fullKey == "${BASE}"); + if (overrideBase) { LINFO(fmt::format("Overriding base path with '{}'", path.second)); } + const bool overrideTemporary = (fullKey == "${TEMPORARY}"); + using Override = ghoul::filesystem::FileSystem::Override; FileSys.registerPathToken( std::move(fullKey), std::move(path.second), - Override(override) + Override(overrideBase || overrideTemporary) ); } - LTRACE("OpenSpaceEngine::initialize(end)"); } From 071d4af9dc82bd9a6135c069b82a73cb9e1b11f3 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 16:09:54 +0200 Subject: [PATCH 08/10] Remove warnings duplicating property initialization for renderabletrails --- modules/base/rendering/renderabletrail.cpp | 26 +++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index 4ff75279d2..23ab9b9263 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -202,7 +202,6 @@ RenderableTrail::Appearance::Appearance() RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) : Renderable(dictionary) { - setRenderBin(RenderBin::Overlay); addProperty(_opacity); @@ -212,35 +211,28 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) addPropertySubOwner(_translation.get()); _appearance.lineColor = dictionary.value(LineColorInfo.identifier); - addProperty(_appearance.lineColor); if (dictionary.hasKeyAndValue(EnableFadeInfo.identifier)) { _appearance.useLineFade = dictionary.value(EnableFadeInfo.identifier); } - addProperty(_appearance.useLineFade); if (dictionary.hasKeyAndValue(FadeInfo.identifier)) { - _appearance.lineFade = static_cast(dictionary.value(FadeInfo.identifier)); + _appearance.lineFade = static_cast( + dictionary.value(FadeInfo.identifier) + ); } - addProperty(_appearance.lineFade); if (dictionary.hasKeyAndValue(LineWidthInfo.identifier)) { _appearance.lineWidth = static_cast(dictionary.value( LineWidthInfo.identifier )); } - addProperty(_appearance.lineWidth); if (dictionary.hasKeyAndValue(PointSizeInfo.identifier)) { - _appearance.pointSize = static_cast(dictionary.value(PointSizeInfo.identifier)); + _appearance.pointSize = static_cast( + dictionary.value(PointSizeInfo.identifier) + ); } - addProperty(_appearance.pointSize); - - _appearance.renderingModes.addOptions({ - { RenderingModeLines, "Lines" }, - { RenderingModePoints, "Points" }, - { RenderingModeLinesPoints, "Lines+Points" } - }); // This map is not accessed out of order as long as the Documentation is adapted // whenever the map changes. The documentation will check for valid values @@ -252,7 +244,8 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) else { _appearance.renderingModes = RenderingModeLines; } - addProperty(_appearance.renderingModes); + + addPropertySubOwner(_appearance); } void RenderableTrail::initializeGL() { @@ -331,7 +324,8 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) { } auto render = [renderLines, renderPoints, p = _programObject, &data, - &modelTransform, pointSize = _appearance.pointSize.value(), c = _uniformCache] + &modelTransform, pointSize = _appearance.pointSize.value(), + c = _uniformCache] (RenderInformation& info, int nVertices, int offset) { // We pass in the model view transformation matrix as double in order to maintain From 40545d99e5e1c2b24dfcf9bcef85c0cae45a5d93 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 16:31:55 +0200 Subject: [PATCH 09/10] Make Screenspace renderable work again (closes #959) --- include/openspace/rendering/renderengine.h | 3 +++ src/rendering/renderengine.cpp | 8 ++++++++ src/rendering/screenspacerenderable.cpp | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index b529926ee1..b848712074 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -92,6 +92,9 @@ public: float globalBlackOutFactor(); void setGlobalBlackOutFactor(float opacity); + float hdrExposure() const; + bool isHdrDisabled() const; + void addScreenSpaceRenderable(std::unique_ptr s); void removeScreenSpaceRenderable(ScreenSpaceRenderable* s); void removeScreenSpaceRenderable(const std::string& identifier); diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index ccfbb5a739..de5ed0052a 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -938,6 +938,14 @@ void RenderEngine::setGlobalBlackOutFactor(float opacity) { _globalBlackOutFactor = opacity; } +float RenderEngine::hdrExposure() const { + return _hdrExposure; +} + +bool RenderEngine::isHdrDisabled() const { + return _disableHDRPipeline; +} + /** * Build a program object for rendering with the used renderer */ diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index d8aa117073..9a3b01f0dc 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -500,7 +500,9 @@ void ScreenSpaceRenderable::createShaders() { ghoul::Dictionary rendererData = { { "fragmentRendererPath", "${SHADERS}/framebuffer/renderframebuffer.frag" }, { "windowWidth" , res.x }, - { "windowHeight" , res.y } + { "windowHeight" , res.y }, + { "hdrExposure", global::renderEngine.hdrExposure() }, + { "disableHDR", global::renderEngine.isHdrDisabled() } }; dict.setValue("rendererData", rendererData); From 6ae42d0b2fc909685af4bfddd14a335d088a9fd9 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 22 Aug 2019 17:08:53 +0200 Subject: [PATCH 10/10] Update version number for the release candidate --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 724729bcad..085fdbafc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,9 +27,9 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR) project(OpenSpace) set(OPENSPACE_VERSION_MAJOR 0) -set(OPENSPACE_VERSION_MINOR 14) -set(OPENSPACE_VERSION_PATCH 1) -set(OPENSPACE_VERSION_STRING "Beta-4") +set(OPENSPACE_VERSION_MINOR 15) +set(OPENSPACE_VERSION_PATCH -1) +set(OPENSPACE_VERSION_STRING "Beta-5") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}")