Merge remote-tracking branch 'origin/master' into feature/multiresvolume

Adding enlil.scene asset
# Conflicts:
#	src/util/transformationmanager.cpp
This commit is contained in:
Matthew Territo
2018-03-14 13:03:56 -06:00
16 changed files with 167 additions and 45 deletions

View File

@@ -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",

104
data/assets/enlil.scene Normal file
View File

@@ -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)

View File

@@ -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"
})

View File

@@ -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,
}
},
{

View File

@@ -83,7 +83,8 @@ public:
void clearSynchronizations();
std::vector<std::shared_ptr<ResourceSynchronization>> ownSynchronizations() const;
void syncStateChanged(ResourceSynchronization::State s);
void syncStateChanged(std::shared_ptr<ResourceSynchronization> sync,
ResourceSynchronization::State s);
/**
* Load this asset and return true if successful,

View File

@@ -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{

View File

@@ -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;

View File

@@ -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;

View File

@@ -98,8 +98,8 @@ namespace {
node.children.begin(),
node.children.end(),
[p = *path.begin()](const std::unique_ptr<TreeNode>& c) {
return c.get()->path == p;
}
return c.get()->path == p;
}
);
TreeNode* n;
@@ -112,7 +112,6 @@ namespace {
std::unique_ptr<TreeNode> newNode = std::make_unique<TreeNode>(*path.begin());
n = newNode.get();
node.children.push_back(std::move(newNode));
}
// Recurse into the tree and chop off the first path

View File

@@ -51,6 +51,7 @@
#include <math.h>
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<std::string>(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<float>(dictionary.value<double>(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<std::string>(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<float>((radius.x + radius.y + radius.z) / 3.0);
}
else {
LERRORC("RenderablePlanet", "Missing radius specification");
}
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(geomDict);

View File

@@ -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 "

View File

@@ -143,7 +143,7 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
}
}
if (_startTime != "" && _endTime != "") {
if (!_startTime.empty() && !_endTime.empty()) {
_hasTimeInterval = true;
}

View File

@@ -173,8 +173,8 @@ void Asset::addSynchronization(std::shared_ptr<ResourceSynchronization> 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<ResourceSynchronization> 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);
}
}

View File

@@ -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;
}

View File

@@ -32,7 +32,10 @@ TransformationManager::TransformationManager(){
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
_kameleon = std::make_shared<ccmc::Kameleon>();
#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);
}