Files
OpenSpace/data/assets/newhorizons.scene
T

200 lines
7.7 KiB
Plaintext

local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
local renderableHelper = asset.require('util/renderable_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('scene/digitaluniverse/milkyway')
asset.require('scene/solarsystem/missions/newhorizons/newhorizons')
-- Load default key bindings applicable to most scenes
asset.require('util/default_keybindings')
asset.require('util/default_dashboard')
-- Custom Keybindings
local Keybindings = {
{
Key = "a",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'NewHorizons')",
Documentation = "Sets the focus of the camera on 'NewHorizons'.",
Local = false
},
{
Key = "s",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'Pluto')",
Documentation = "Sets the focus of the camera on 'Pluto'",
Local = false
},
{
Key = "d",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'Charon')",
Documentation = "Sets the focus of the camera on 'Charon'.",
Local = false
},
{
Key = "F8",
Command = "openspace.setPropertyValue('Scene.Pluto.renderable.ProjectionComponent.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.renderable.ProjectionComponent.ClearAllProjections', true);",
Documentation = "Removes all image projections from Pluto and Charon.",
Local = false
},
{
Key = "F9",
Command = "openspace.time.setTime('2015-07-14T09:00:00.00');" ..
"openspace.setPropertyValue('Scene.Pluto.renderable.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.renderable.ClearAllProjections', true);",
Documentation = "Jumps to the 14th of July 2015 at 0900 UTC and clears all projections.",
Local = false
},
{
Key = "KP_8",
Command = propertyHelper.increment('Scene.Pluto.renderable.HeightExaggeration', 5000000),
Documentation = "Increases the height map exaggeration on Pluto.",
Local = false
},
{
Key = "KP_2",
Command = propertyHelper.decrement('Scene.Pluto.renderable.HeightExaggeration', 5000000),
Documentation = "Decreases the height map exaggeration on Pluto.",
Local = false
},
{
Key = "KP_9",
Command = propertyHelper.increment('Scene.Charon.renderable.HeightExaggeration', 5000000),
Documentation = "Increases the height map exaggeration on Charon.",
Local = false
},
{
Key = "KP_3",
Command = propertyHelper.decrement('Scene.Charon.renderable.HeightExaggeration', 5000000),
Documentation = "Decreases the height map exaggeration on Charon.",
Local = false
},
{
Key = "q",
Command = propertyHelper.invert('Scene.SunMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Sun.",
Local = false
},
{
Key = "e",
Command = propertyHelper.invert('Scene.EarthMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Earth.",
Local = false
},
{
Key = "o",
Command = propertyHelper.invert('Scene.PlutoTrail.renderable.Enabled'),
Documentation = "Toggles the visibility of the trail behind Pluto.",
Local = false
},
{
Key = "j",
Command = renderableHelper.toggle('Scene.PlutoText') .. renderableHelper.toggle('Scene.CharonText') ..
renderableHelper.toggle('Scene.HydraText') .. renderableHelper.toggle('Scene.NixText') ..
renderableHelper.toggle('Scene.KerberosText') .. renderableHelper.toggle('Scene.StyxText'),
Documentation = "Toggles the visibility of the text labels of Pluto, Charon, Hydra, Nix, Kerberos, and Styx.",
Local = false
},
{
Key = "l",
Command = propertyHelper.fadeInOut('Scene.Labels.renderable.Opacity', 2.0),
Documentation = "Toggles the visibility of the labels for the New Horizons instruments.",
Local = false
},
{
Key = "m",
Command = propertyHelper.invert('Scene.NH_LORRI.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_LEISA.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN1.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN2.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_RED.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_BLUE.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_FT.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_METHANE.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_NIR.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_AIRGLOW.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_SOC.renderable.SolidDraw'),
Documentation = "Draws the instrument field of views in a solid color or as lines.",
Local = false
},
{
Key = "t",
Command = renderableHelper.toggle('Scene.PlutoShadow') .. renderableHelper.toggle('Scene.CharonShadow'),
Documentation = "Toggles the visibility of the shadow visualization of Pluto and Charon.",
Local = false
}
}
local NewHorizonsAsset = asset.require('scene/solarsystem/missions/newhorizons/model')
assetHelper.registerDashboardItems(asset, {
{
Type = "DashboardItemSpacing",
Identifier = "NewHorizonsSpacing",
GuiName = "New Horizons Spacing",
Spacing = 25
},
{
Type = "DashboardItemDistance",
Identifier = "NewHorizonsPlutoDistance",
GuiName = "New Horizons Pluto Distance",
SourceType = "Node",
SourceNodeName = "NewHorizons",
DestinationType = "Node Surface",
DestinationNodeName = "Pluto"
},
{
Type = "DashboardItemInstruments",
Identifier = "NewHorizonsInstruments",
GuiName = "NewHorizons Instruments",
}
})
asset.onInitialize(function ()
openspace.time.setTime("2015-07-14T08:00:00.00")
sceneHelper.bindKeys(Keybindings)
openspace.setDefaultGuiSorting()
sceneHelper.setDeltaTimeKeys({
1, 5, 10, 20, 40, 60, 120, 360, 540, 1080,
2160, 4320, 8640
})
openspace.markInterestingNodes({
"Pluto", "NewHorizons", "Charon"
})
openspace.setPropertyValueSingle('NavigationHandler.OrbitalNavigator.FollowFocusNodeRotationDistance', 20.000000);
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,
nil
)
openspace.navigation.setCameraState({
Focus = NewHorizonsAsset.NewHorizons.Identifier,
Position = { 4662120063743.592773, 1263245003503.724854, -955413856565.788086 },
Rotation = { 0.683224, -0.165934, 0.701234, 0.118073 },
})
end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.renderable.Enabled")
openspace.removeInterestingNodes({
"Pluto", "NewHorizons", "Charon"
})
end)