Files
OpenSpace/data/assets/dsn.scene
2019-01-08 18:27:54 -05:00

163 lines
5.7 KiB
Plaintext

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/solarsystem/planets')
asset.request('scene/digitaluniverse/stars')
asset.request('customization/globebrowsing')
asset.request('scene/digitaluniverse/grids')
-- Spacecrafts
asset.require('scene/solarsystem/dsn/spacecrafts')
--Labels
asset.require('scene/solarsystem/dsn/spacecraftslabels')
-- Stations
asset.require('scene/solarsystem/dsn/stations')
--Signals
asset.require('scene/solarsystem/dsn/signals')
-- Load default key bindings applicable to most scenes
asset.require('util/default_keybindings')
asset.require('util/default_dashboard')
asset.require('util/default_joystick')
asset.require('util/webgui')
local Keybindings = {
{
Key = "z",
Command = "openspace.time.interpolateDeltaTime(3)",
Documentation = "Set speed to work for near earth view.",
Local = false
},
{
Key = "x",
Command = "openspace.time.interpolateDeltaTime(360)",
Documentation = "Set speed to work for inner space view.",
Local = false
},
{
Key = "c",
Command = "openspace.time.interpolateDeltaTime(4200)",
Documentation = "Set speed to work for outer space.",
Local = false
},
{
Key = "s",
Command = propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth at Night 2012.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.PerformShading') ..
propertyHelper.invert('Scene.Earth.Renderable.Atmosphere') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
Documentation = "Toggle night texture, shading, atmosphere, and water for Earth.",
Local = false
},
{
Key = "g",
Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.Renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Enabled') ..
propertyHelper.invert('Scene.EarthAtmosphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.MarsAtmosphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
propertyHelper.invert('Scene.Moon.Renderable.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', true)",
Documentation = "Enables visibility of the trails",
Local = false
},
{
Key = "j",
Command = "openspace.setPropertyValue('Scene.*Trail.Renderable.Enabled', false)",
Documentation = "Disables visibility of the trails",
Local = false
},
{
Key = "e",
Command = propertyHelper.invert('Scene.EquatorialSphere.Renderable.Enabled') ..
propertyHelper.invert('Scene.EquatorialSphereLabels.Renderable.Enabled'),
Documentation = "Toggles visibility of the equatorial sphere and its labels",
Local = false
},
{
Key = "l",
Command = propertyHelper.invert('Scene.OuterSpaceLabels.Renderable.Enabled') ..
propertyHelper.invert('Scene.InnerSpaceLabels.Renderable.Enabled') ..
propertyHelper.invert('Scene.MarsMissionsLabels.Renderable.Enabled') ..
propertyHelper.invert('Scene.ClusteredLabels.Renderable.Enabled') ..
propertyHelper.invert('Scene.NearEarthLabels.Renderable.Enabled'),
Documentation = "Toggles visibility of the spacecraft labels",
Local = false
}
}
local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
local equatorial = asset.require('scene/digitaluniverse/grids')
asset.onInitialize(function ()
--local now = openspace.time.currentWallTime()
openspace.time.setTime("2018 SEP 03 11:11:00")
sceneHelper.bindKeys(Keybindings)
openspace.setDefaultGuiSorting()
openspace.setPropertyValue('Scene.*Trail.Renderable.Enabled', false)
openspace.setPropertyValue('Scene.*Trail.Renderable.Color', {0.5,0.5,0.5})
openspace.globebrowsing.loadWMSServersFromFile(
openspace.absPath("${DATA}/globebrowsing_servers.lua")
)
openspace.markInterestingNodes({
"VGR1", "VGR2", "Earth", "DSS63", "DSS14", "DSS43"
})
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.Identifier,
Position = { 0, 0, 0 },
Rotation = { 0.758797, 0.221490, -0.605693, -0.091135 },
})
-- Earth view
openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000)
-- outer space view
-- openspace.globebrowsing.goToGeo(0, 90, 20000000000000)
end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("Scene.*Trail.Renderable.Enabled")
openspace.removeInterestingNodes({
"VGR1", "VGR2", "Earth", "DSS63", "DSS14", "DSS43"
})
end)