Files
OpenSpace/data/assets/mas.scene
T
2018-07-17 11:22:53 -04:00

107 lines
3.1 KiB
Plaintext

local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
asset.require('util/default_dashboard')
-- Specifying which other assets should be loaded in this scene
asset.require('spice/base')
assetHelper.requestAll(asset, 'scene/solarsystem/sun')
assetHelper.requestAll(asset, 'scene/digitaluniverse')
-- Load default key bindings applicable to most scenes
asset.require('util/default_keybindings')
-- asset.request('customization/globebrowsing')
local sunAsset = asset.require('scene/solarsystem/sun/sun')
-- local earthAsset = asset.require('scene/solarsystem/planets/earth/earth')
local masMhdAsset = asset.require('scene/solarsystem/model/mas/mas_mhd')
-- This causes crash because the renderable is not removed properly before the next frame
local toggleMas = function ()
return
-- "openspace.removeSceneGraphNode('Mas_MHD');" ..
"openspace.assset.remove('Mas_MHD');" ..
"openspace.asset.add('Mas_MHD');"
end
local Keybindings = {
{
Key = "F7",
Command = "openspace.time.setTime('2017 AUG 20 00:00:00');",
Documentation = "Set time with margin to when eclipse data starts",
Local = false
},
{
Key = "F8",
Command = "openspace.time.setTime('2017 AUG 21 17:00:00');",
Documentation = "Set time to when eclipse data starts",
Local = false
},
{
Key = "F9",
Command = propertyHelper.invert('Scene.SunGlare.renderable.Enabled'),
Documentation = "Toggle sun glare",
Local = false
},
{
Key = "F10",
Command = propertyHelper.invert('Scene.Sun.renderable.Enabled'),
Documentation = "Toggle sun",
Local = false
},
{
Key = "t",
Command = toggleMas(),
Documentation = "Toggle mas asset on/off",
Local = false
}
}
asset.onInitialize(function ()
-- openspace.time.setTime("2017 JUN 01 00:00:00")
openspace.time.setTime(openspace.time.currentWallTime())
sceneHelper.bindKeys(Keybindings)
openspace.setPropertyValueSingle('Scene.SunGlare.renderable.Enabled', false);
openspace.setDefaultGuiSorting()
-- openspace.globebrowsing.loadWMSServersFromFile(
-- openspace.absPath("${DATA}/globebrowsing_servers.lua")
-- )
openspace.markInterestingNodes({
"Mas_MHD"
})
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"Scene.*Trail.renderable.Enabled",
"Disable or enable all trails of the sHmmcene at the same time",
true,
nil,
nil
)
openspace.navigation.setCameraState({
Focus = masMhdAsset.Mas_MHD.Identifier,
Position = { 10000000000, 10000000000, 10000000000 },
Rotation = { 0.758797, 0.221490, -0.605693, -0.091135 },
})
end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeInterestingNodes({
"Mas_MHD"
})
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
end)