From 7d1ee75577c8632cb1e90ff15dcb3386a704d508 Mon Sep 17 00:00:00 2001 From: Jonathan Grangien Date: Wed, 14 Mar 2018 11:37:18 -0400 Subject: [PATCH 1/7] Fix a _loggerCat declaration --- src/util/transformationmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index 05a96963db..e9555c0f20 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -28,6 +28,8 @@ namespace openspace { +constexpr const char* _loggerCat = "TransformationManager"; + TransformationManager::TransformationManager(){ #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED _kameleon = std::make_shared(); From 2bfab657f3e3ea846743d234f698cb17ad70ad35 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 14 Mar 2018 13:13:23 -0400 Subject: [PATCH 2/7] Various small fixes --- data/assets/examples/urlsynchronization.asset | 10 ++--- ext/ghoul | 2 +- modules/base/dashboard/dashboarditemangle.cpp | 2 +- modules/imgui/src/guipropertycomponent.cpp | 5 +-- modules/space/rendering/renderableplanet.cpp | 39 +++++++++++++------ .../util/projectioncomponent.cpp | 3 +- src/rendering/renderable.cpp | 2 +- src/scripting/scriptscheduler_lua.inl | 1 + 8 files changed, 41 insertions(+), 23 deletions(-) diff --git a/data/assets/examples/urlsynchronization.asset b/data/assets/examples/urlsynchronization.asset index 1286bdd9b8..630eb4762b 100644 --- a/data/assets/examples/urlsynchronization.asset +++ b/data/assets/examples/urlsynchronization.asset @@ -3,15 +3,15 @@ local assetHelper = asset.require("util/asset_helper") asset.syncedResource({ - Type = "UrlSynchronization", Name = "Example Single", + Type = "UrlSynchronization", Identifier = "example_single", Url = "http://celestrak.com/NORAD/elements/geo.txt" }) asset.syncedResource({ - Type = "UrlSynchronization", Name = "Example Multiple", + Type = "UrlSynchronization", Identifier = "example_multiple", Url = { "http://celestrak.com/NORAD/elements/stations.txt", @@ -20,23 +20,23 @@ asset.syncedResource({ }) asset.syncedResource({ - Type = "UrlSynchronization", Name = "Example Large", + Type = "UrlSynchronization", Identifier = "example_large", Url = "http://ipv4.download.thinkbroadband.com/100MB.zip", Override = true }) asset.syncedResource({ - Type = "UrlSynchronization", Name = "Example Medium", + Type = "UrlSynchronization", Identifier = "example_medium", Url = "http://ipv4.download.thinkbroadband.com/5MB.zip", Override = true }) asset.syncedResource({ - Type = "UrlSynchronization", Name = "Example No ident", + Type = "UrlSynchronization", Url = "http://ipv4.download.thinkbroadband.com/5MB.zip" }) diff --git a/ext/ghoul b/ext/ghoul index 1c8513b4ae..a796b61604 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 1c8513b4ae8bd59245b6d9d80fb42fe3bb42e2d2 +Subproject commit a796b61604af408329f5b605d39fe8b56b46df8a diff --git a/modules/base/dashboard/dashboarditemangle.cpp b/modules/base/dashboard/dashboarditemangle.cpp index 517d5b8aa5..6fa4b418df 100644 --- a/modules/base/dashboard/dashboarditemangle.cpp +++ b/modules/base/dashboard/dashboarditemangle.cpp @@ -174,7 +174,7 @@ documentation::Documentation DashboardItemAngle::Documentation() { } DashboardItemAngle::DashboardItemAngle(ghoul::Dictionary dictionary) - : DashboardItem("Distance") + : DashboardItem("Angle") , _fontName(FontNameInfo, KeyFontMono) , _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f) , _source{ diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index 1669b9f84a..174796859b 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -98,8 +98,8 @@ namespace { node.children.begin(), node.children.end(), [p = *path.begin()](const std::unique_ptr& c) { - return c.get()->path == p; - } + return c.get()->path == p; + } ); TreeNode* n; @@ -112,7 +112,6 @@ namespace { std::unique_ptr newNode = std::make_unique(*path.begin()); n = newNode.get(); node.children.push_back(std::move(newNode)); - } // Recurse into the tree and chop off the first path diff --git a/modules/space/rendering/renderableplanet.cpp b/modules/space/rendering/renderableplanet.cpp index 2d5e02a9c5..9d78fee550 100644 --- a/modules/space/rendering/renderableplanet.cpp +++ b/modules/space/rendering/renderableplanet.cpp @@ -51,6 +51,7 @@ #include namespace { + constexpr const char* KeyBody = "Body"; constexpr const char* KeyGeometry = "Geometry"; constexpr const char* KeyRadius = "Radius"; constexpr const char* _loggerCat = "RenderablePlanet"; @@ -118,7 +119,15 @@ documentation::Documentation RenderablePlanet::Documentation() { new DoubleVerifier, Optional::Yes, "Specifies the radius of the planet. If this value is not specified, it " - "will try to query the SPICE library for radius values." + "will try to query the SPICE library for radius values using the body " + "key." + }, + { + KeyBody, + new StringVerifier, + Optional::Yes, + "If that radius is not specified, this name is used to query the SPICE " + "library for the radius values." }, { ColorTextureInfo.identifier, @@ -178,11 +187,6 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary) , _shadowEnabled(false) , _time(0.f) { - ghoul_precondition( - dictionary.hasKeyAndValue(SceneGraphNode::KeyName), - "RenderablePlanet needs the name to be specified" - ); - documentation::testSpecificationAndThrow( Documentation(), dictionary, @@ -197,19 +201,32 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary) // If the user specified a radius, we want to use this _planetRadius = static_cast(dictionary.value(KeyRadius)); } - else if (SpiceManager::ref().hasValue(name, "RADII") ) { + else { + if (!dictionary.hasKey(KeyBody)) { + documentation::TestResult res; + res.success = false; + documentation::TestResult::Offense offense = { + fmt::format("{} or {}", KeyRadius, KeyBody), + documentation::TestResult::Offense::Reason::MissingKey + }; + res.offenses.push_back(std::move(offense)); + throw documentation::SpecificationError( + std::move(res), + std::move("RenderablePlanet") + ); + } + + const std::string body = dictionary.value(KeyBody); + // If the user didn't specfify a radius, but Spice has a radius, we can use this glm::dvec3 radius; - SpiceManager::ref().getValue(name, "RADII", radius); + SpiceManager::ref().getValue(body, "RADII", radius); radius *= 1000.0; // Spice gives radii in KM. std::swap(radius[1], radius[2]); // z is equivalent to y in our coordinate system geomDict.setValue(KeyRadius, radius); _planetRadius = static_cast((radius.x + radius.y + radius.z) / 3.0); } - else { - LERRORC("RenderablePlanet", "Missing radius specification"); - } _geometry = planetgeometry::PlanetGeometry::createFromDictionary(geomDict); diff --git a/modules/spacecraftinstruments/util/projectioncomponent.cpp b/modules/spacecraftinstruments/util/projectioncomponent.cpp index 292939f768..e248838cbe 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.cpp +++ b/modules/spacecraftinstruments/util/projectioncomponent.cpp @@ -153,7 +153,8 @@ documentation::Documentation ProjectionComponent::Documentation() { { keySequenceType, new StringInListVerifier( - { sequenceTypeImage, sequenceTypePlaybook, sequenceTypeHybrid } + { sequenceTypeImage, sequenceTypePlaybook, sequenceTypeHybrid, + sequenceTypeInstrumentTimes } ), Optional::Yes, "This value determines which type of sequencer is used for generating " diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 2c00efaaa3..b30d62e5fe 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -143,7 +143,7 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary) } } - if (_startTime != "" && _endTime != "") { + if (!_startTime.empty() && !_endTime.empty()) { _hasTimeInterval = true; } diff --git a/src/scripting/scriptscheduler_lua.inl b/src/scripting/scriptscheduler_lua.inl index ab32cbf98c..3aa1d5192a 100644 --- a/src/scripting/scriptscheduler_lua.inl +++ b/src/scripting/scriptscheduler_lua.inl @@ -84,6 +84,7 @@ int loadScheduledScript(lua_State* L) { }); } + lua_settop(L, 0); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; } From 600f11b5f6a4f006df708f6d24b475a1277639d9 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 14 Mar 2018 13:16:32 -0400 Subject: [PATCH 3/7] Update Transformationmanager --- src/util/transformationmanager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index e9555c0f20..f84580190d 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -28,13 +28,14 @@ namespace openspace { -constexpr const char* _loggerCat = "TransformationManager"; - TransformationManager::TransformationManager(){ #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED _kameleon = std::make_shared(); #else - LWARNING("Kameleon module needed for transformations with dynamic frames"); + LWARNINGC( + "TransformationManager", + "Kameleon module needed for transformations with dynamic frames" + ); #endif _kameleonFrames = { "J2000", "GEI", "GEO", "MAG", "GSE", "GSM", "SM", "RTN", "GSEQ", //geocentric @@ -122,7 +123,10 @@ glm::dmat3 TransformationManager::frameTransformationMatrix( return kameleonTransformation*spiceTransformation; } #else - LERROR("Can not transform dynamic frames without kameleon module enabled"); + LERRORC( + "TransformationManager", + "Can not transform dynamic frames without kameleon module enabled" + ); #endif return glm::dmat3(1.0); } From 206ff69e41e95223bf3d190c08fb59873b3b7473 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Wed, 14 Mar 2018 13:18:19 -0400 Subject: [PATCH 4/7] Fixed normals. (#553) --- modules/base/shaders/model_fs.glsl | 3 +-- modules/base/shaders/model_vs.glsl | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/base/shaders/model_fs.glsl b/modules/base/shaders/model_fs.glsl index fe5d414849..f84b508a0c 100644 --- a/modules/base/shaders/model_fs.glsl +++ b/modules/base/shaders/model_fs.glsl @@ -28,7 +28,6 @@ in vec2 vs_st; in vec3 vs_normalViewSpace; in vec4 vs_positionCameraSpace; in float vs_screenSpaceDepth; -in vec3 vs_normalObjSpace; uniform bool performShading = true; uniform vec3 directionToSunViewSpace; @@ -73,7 +72,7 @@ Fragment getFragment() { frag.color.a = opacity; frag.depth = vs_screenSpaceDepth; frag.gPosition = vs_positionCameraSpace; - frag.gNormal = vec4(vs_normalObjSpace, 1.0); + frag.gNormal = vec4(vs_normalViewSpace, 1.0); return frag; diff --git a/modules/base/shaders/model_vs.glsl b/modules/base/shaders/model_vs.glsl index 7d052b9594..0c1c036c5d 100644 --- a/modules/base/shaders/model_vs.glsl +++ b/modules/base/shaders/model_vs.glsl @@ -34,7 +34,6 @@ out vec2 vs_st; out vec3 vs_normalViewSpace; out float vs_screenSpaceDepth; out vec4 vs_positionCameraSpace; -out vec3 vs_normalObjSpace; uniform mat4 modelViewTransform; uniform mat4 projectionTransform; From d2fa7140d798198eaf2410b0f2c553ab56bae830 Mon Sep 17 00:00:00 2001 From: Jonathas Costa Date: Wed, 14 Mar 2018 13:18:42 -0400 Subject: [PATCH 5/7] Fixed compiling issues with log, reset night layer configuration and disabled earth's shading by default. (#552) --- data/assets/default.scene | 1 + .../scene/solarsystem/planets/earth/earth.asset | 12 +----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/data/assets/default.scene b/data/assets/default.scene index b32bf5da5c..489bd57d00 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -72,6 +72,7 @@ asset.onInitialize(function () "Earth", "Mars", "Moon" }) + openspace.setPropertyValue("Scene.Earth.RenderableGlobe.PerformShading", false) openspace.addVirtualProperty( "BoolProperty", diff --git a/data/assets/scene/solarsystem/planets/earth/earth.asset b/data/assets/scene/solarsystem/planets/earth/earth.asset index b8cefd4c13..f6623a2061 100644 --- a/data/assets/scene/solarsystem/planets/earth/earth.asset +++ b/data/assets/scene/solarsystem/planets/earth/earth.asset @@ -146,20 +146,10 @@ local Earth = { Name = "Earth at Night 2012", FilePath = mapServiceConfigsPath .. "/GIBS/night/VIIRS_CityLights_2012.wms", Enabled = true, - Settings = { - Opacity = 1.0, - Gamma = 1.5, - Multiplier = 15.0 - }, Fallback = { Name = "Earth Night", FilePath = texturesPath .. "/earth_night.jpg", - Enabled = true, - Settings = { - Opacity = 1.0, - Gamma = 1.5, - Multiplier = 15.0 - }, + Enabled = true, } }, { From bc5712bc5bd062cc7d5465779de0ef59dcde3b83 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 14 Mar 2018 13:20:03 -0400 Subject: [PATCH 6/7] Remove setPropertyValue to explicitly disable shading and use the asset specification instead --- data/assets/default.scene | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/assets/default.scene b/data/assets/default.scene index 489bd57d00..d84c9e0fb2 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -72,8 +72,6 @@ asset.onInitialize(function () "Earth", "Mars", "Moon" }) - openspace.setPropertyValue("Scene.Earth.RenderableGlobe.PerformShading", false) - openspace.addVirtualProperty( "BoolProperty", "Show Trails", From 0ce8605b9714732d48b575cb8bc4e9bac560573b Mon Sep 17 00:00:00 2001 From: Emil Axelsson Date: Wed, 14 Mar 2018 18:29:38 +0100 Subject: [PATCH 7/7] Print error message when a resource synchronization is rejected (#546) * Print error message when a resource synchronization is rejected --- include/openspace/scene/asset.h | 3 ++- src/scene/asset.cpp | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index e1185694ff..34ef37497a 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -83,7 +83,8 @@ public: void clearSynchronizations(); std::vector> ownSynchronizations() const; - void syncStateChanged(ResourceSynchronization::State s); + void syncStateChanged(std::shared_ptr sync, + ResourceSynchronization::State s); /** * Load this asset and return true if successful, diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 1521c30823..185919c430 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -173,8 +173,8 @@ void Asset::addSynchronization(std::shared_ptr synchron SynchronizationWatcher::WatchHandle watch = _synchronizationWatcher->watchSynchronization( synchronization, - [this](ResourceSynchronization::State state) { - syncStateChanged(state); + [this, synchronization](ResourceSynchronization::State state) { + syncStateChanged(synchronization, state); } ); _syncWatches.push_back(watch); @@ -187,12 +187,19 @@ void Asset::clearSynchronizations() { _syncWatches.clear(); } -void Asset::syncStateChanged(ResourceSynchronization::State state) { +void Asset::syncStateChanged(std::shared_ptr sync, + ResourceSynchronization::State state) +{ + if (state == ResourceSynchronization::State::Resolved) { if (!isSynchronized() && isSyncResolveReady()) { setState(State::SyncResolved); } } else if (state == ResourceSynchronization::State::Rejected) { + LERROR(fmt::format( + "Failed to synchronize resource '{}'' in asset '{}'", sync->name(), id() + )); + setState(State::SyncRejected); } }