Files
OpenSpace/data/assets/newhorizons.scene
T
Emil Axelsson 2e71eaa4cb Feature/anchor and aim (#799)
Introduce the ability to navigate using an anchor and aim.
Example use: Set spacecraft as anchor and planet as aim to always look down at a planet, while followin the spacecraft in its orbit.
2019-02-19 18:46:58 +01:00

239 lines
9.2 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')
asset.require('util/default_joystick')
asset.require('util/webgui')
asset.request('customization/globebrowsing')
-- Custom Keybindings
local Keybindings = {
{
Key = "a",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'NewHorizons')",
Documentation = "Sets the focus of the camera on 'NewHorizons'.",
Name = "Focus on New Horizons",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "s",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'Pluto')",
Documentation = "Sets the focus of the camera on 'Pluto'",
Name = "Focus on Pluto",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "d",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'Charon')",
Documentation = "Sets the focus of the camera on 'Charon'.",
Name = "Focus on New Charon",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "F7",
Command =
[[local enabled = openspace.getPropertyValue('Scene.Pluto.Renderable.ProjectionComponent.PerformProjection')
openspace.setPropertyValue('Scene.Pluto.Renderable.ProjectionComponent.PerformProjection', not enabled)
openspace.setPropertyValue('Scene.Charon.Renderable.ProjectionComponent.PerformProjection', not enabled)
openspace.setPropertyValueSingle("Dashboard.NewHorizonsInstruments.Enabled", not enabled)]],
Documentation = "Toggles New Horizons image projection.",
Name = "Toggle NH Image Projection",
GuiPath = "/New Horizons",
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.",
Name = "Clear image projections",
GuiPath = "/New Horizons",
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.",
Name = "Reset time and projections",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "KP_8",
Command = propertyHelper.increment('Scene.Pluto.Renderable.HeightExaggeration', 5000),
Documentation = "Increases the height map exaggeration on Pluto.",
Name = "Pluto HeightExaggeration +",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "KP_2",
Command = propertyHelper.decrement('Scene.Pluto.Renderable.HeightExaggeration', 5000),
Documentation = "Decreases the height map exaggeration on Pluto.",
Name = "Pluto HeightExaggeration -",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "KP_9",
Command = propertyHelper.increment('Scene.Charon.Renderable.HeightExaggeration', 5000),
Documentation = "Increases the height map exaggeration on Charon.",
Name = "Charon HeightExaggeration +",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "KP_3",
Command = propertyHelper.decrement('Scene.Charon.Renderable.HeightExaggeration', 5000),
Documentation = "Decreases the height map exaggeration on Charon.",
Name = "Charon HeightExaggeration -",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "o",
Command = propertyHelper.invert('Scene.PlutoTrail.Renderable.Enabled'),
Documentation = "Toggles the visibility of the trail behind Pluto.",
Name = "Toggle Pluto Trail",
GuiPath = "/New Horizons",
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.",
Name = "Toggle Pluto Labels",
GuiPath = "/New Horizons",
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.",
Name = "Toggle New Horizons Labels",
GuiPath = "/New Horizons",
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.",
Name = "Toggle instrument FOVs",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "Shift+t",
Command = renderableHelper.toggle('Scene.PlutoShadow') .. renderableHelper.toggle('Scene.CharonShadow'),
Documentation = "Toggles the visibility of the shadow visualization of Pluto and Charon.",
Name = "Toggle Shadows",
GuiPath = "/New Horizons",
Local = false
},
{
Key = "t",
Command = renderableHelper.toggle('Scene.NewHorizonsTrailPluto'),
Documentation = "Toggles the trail of New Horizons.",
Name = "Toggle NH Trail",
GuiPath = "/New Horizons",
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",
}
})
assetHelper.registerInterestingNodes(asset, {
"Pluto", "NewHorizons", "Charon"
})
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.setPropertyValueSingle('NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance', 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({
Anchor = 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")
end)