diff --git a/data/assets/default.scene b/data/assets/default.scene index 8fc9ed2306..d84c9e0fb2 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -5,7 +5,6 @@ local propertyHelper = asset.require('util/property_helper') -- Specifying which other assets should be loaded in this scene asset.require('spice/base') assetHelper.requestAll(asset, 'scene/solarsystem/sun') -asset.require('scene/multires/enlil') asset.require('scene/solarsystem/planets') asset.require('scene/solarsystem/planets/mars/moons/phobos') asset.require('scene/solarsystem/planets/mars/moons/deimos') @@ -73,7 +72,6 @@ asset.onInitialize(function () "Earth", "Mars", "Moon" }) - openspace.addVirtualProperty( "BoolProperty", "Show Trails", diff --git a/data/assets/enlil.scene b/data/assets/enlil.scene new file mode 100644 index 0000000000..37ffe6be97 --- /dev/null +++ b/data/assets/enlil.scene @@ -0,0 +1,104 @@ +local assetHelper = asset.require('util/asset_helper') +local sceneHelper = asset.require('util/scene_helper') +local propertyHelper = asset.require('util/property_helper') + +-- Specifying which other assets should be loaded in this scene +asset.require('spice/base') +assetHelper.requestAll(asset, 'scene/solarsystem/sun') +asset.require('scene/multires/enlil') +--asset.require('scene/solarsystem/planets') +--asset.require('scene/solarsystem/planets/mars/moons/phobos') +--asset.require('scene/solarsystem/planets/mars/moons/deimos') +--assetHelper.requestAll(asset, 'scene/digitaluniverse') + +-- Load default key bindings applicable to most scenes +asset.require('util/default_keybindings') + +asset.request('customization/globebrowsing') + +-- Keybindings that are specific for this scene +local Keybindings = { + { + Key = "s", + Command = propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.PerformShading') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.Atmosphere') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled'), + Documentation = "Toggle night texture, shading, atmosphere, and water for Earth.", + Local = false + }, + { + Key = "b", + Command = propertyHelper.invert('Scene.MilkyWay.renderable.Enabled') .. + propertyHelper.invert('Scene.Stars.renderable.Enabled'), + Documentation = "Toggle background (Stars and Milkyway).", + Local = false + }, + { + Key = "g", + Command = propertyHelper.invert('Scene.MilkyWay.renderable.Enabled') .. + propertyHelper.invert('Scene.Stars.renderable.Enabled') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.PerformShading') .. + propertyHelper.invert('Scene.Mars.RenderableGlobe.PerformShading') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.Atmosphere') .. + propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled') .. + propertyHelper.invert('Scene.Moon.RenderableGlobe.Enabled') .. + propertyHelper.invert('Scene.Sun.renderable.Enabled'), + Documentation = "Toogles background and shading mode on the Earth and Mars alongside visibility of the Moon and the Sun", + Local = false + }, + { + Key = "h", + Command = "openspace.setPropertyValue('Scene.*Trail.renderable.Enabled', false)", + Documentation = "Disables visibility of the trails", + Local = false + }, +} + +local earthAsset = asset.require('scene/solarsystem/planets/earth/earth') + +asset.onInitialize(function () + openspace.time.setTime(openspace.time.currentWallTime()) + sceneHelper.bindKeys(Keybindings) + + openspace.setDefaultDashboard() + openspace.setDefaultGuiSorting() + + openspace.globebrowsing.loadWMSServersFromFile( + openspace.absPath("${DATA}/globebrowsing_servers.lua") + ) + + openspace.markInterestingNodes({ + "Earth", "Mars", "Moon" + }) + + + openspace.addVirtualProperty( + "BoolProperty", + "Show Trails", + "Scene.*Trail.renderable.Enabled", + "Disable or enable all trails of the scene at the same time", + true, + nil, + nil + ) + + openspace.navigation.setCameraState({ + Focus = earthAsset.Earth.Name, + Position = { 0, 0, 0 }, + Rotation = { 0.758797, 0.221490, -0.605693, -0.091135 }, + }) + + openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000) +end) + +asset.onDeinitialize(function () + sceneHelper.unbindKeys(Keybindings) + + openspace.removeVirtualProperty("*Trail.renderable.Enabled") + + openspace.removeInterestingNodes({ + "Earth", "Mars", "Moon" + }) +end) 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/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, } }, { 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/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/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/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; 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/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); } } 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; } diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index fe80fb7c9b..f84580190d 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -32,7 +32,10 @@ TransformationManager::TransformationManager(){ #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED _kameleon = std::make_shared(); #else - LWARNINGC("TransformationManager", "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 @@ -120,7 +123,10 @@ glm::dmat3 TransformationManager::frameTransformationMatrix( return kameleonTransformation*spiceTransformation; } #else - LERRORC("TransformationManager", "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); }