mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
f43bcadee3
* Replace setCameraState with setNavigationState + equivalents * Add documentation and verification of NavigationState-related interfaces * Documentation and verification fixes * Change reference frame behavior * Scene fixes * Replace earthrise recording with navigation state and time
275 lines
12 KiB
Plaintext
275 lines
12 KiB
Plaintext
asset.require('./base');
|
|
|
|
asset.require('scene/solarsystem/missions/newhorizons/newhorizons')
|
|
local NewHorizonsAsset = asset.require('scene/solarsystem/missions/newhorizons/model')
|
|
|
|
local assetHelper = asset.require('util/asset_helper')
|
|
local propertyHelper = asset.require('util/property_helper')
|
|
local sceneHelper = asset.require('util/scene_helper')
|
|
local renderableHelper = asset.require('util/renderable_helper')
|
|
|
|
local Keybindings = {
|
|
{
|
|
Key = "a",
|
|
Command = "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'NewHorizons');" ..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');" ..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)",
|
|
Documentation = "Sets the focus of the camera on 'NewHorizons'.",
|
|
Name = "Focus on New Horizons",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "SHIFT+a",
|
|
Command = "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'NewHorizons');" ..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', 'Pluto');" ..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)",
|
|
Documentation = "Sets the focus of the camera on 'NewHorizons'.",
|
|
Name = "Anchor at New Horizons, Aim at Pluto",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "s",
|
|
Command = "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'Pluto');"..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');" ..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)",
|
|
Documentation = "Sets the focus of the camera on 'Pluto'",
|
|
Name = "Focus on Pluto",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "d",
|
|
Command = "openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'Charon');"..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');" ..
|
|
"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)",
|
|
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.PlutoProjection.Renderable.ProjectionComponent.PerformProjection')
|
|
openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.PerformProjection', not enabled)
|
|
openspace.setPropertyValue('Scene.CharonProjection.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.PlutoProjection.Renderable.ProjectionComponent.ClearAllProjections', true);" ..
|
|
"openspace.setPropertyValue('Scene.CharonProjection.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.PlutoProjection.Renderable.ProjectionComponent.ClearAllProjections', true);" ..
|
|
"openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.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.PlutoProjection.Renderable.HeightExaggeration', 5000),
|
|
Documentation = "Increases the height map exaggeration on Pluto.",
|
|
Name = "Pluto HeightExaggeration +",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "CTRL+I",
|
|
Command = propertyHelper.increment('Scene.PlutoProjection.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.PlutoProjection.Renderable.HeightExaggeration', 5000),
|
|
Documentation = "Decreases the height map exaggeration on Pluto.",
|
|
Name = "Pluto HeightExaggeration -",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "CTRL+K",
|
|
Command = propertyHelper.decrement('Scene.PlutoProjection.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.CharonProjection.Renderable.HeightExaggeration', 5000),
|
|
Documentation = "Increases the height map exaggeration on Charon.",
|
|
Name = "Charon HeightExaggeration +",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "CTRL+O",
|
|
Command = propertyHelper.increment('Scene.CharonProjection.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.CharonProjection.Renderable.HeightExaggeration', 5000),
|
|
Documentation = "Decreases the height map exaggeration on Charon.",
|
|
Name = "Charon HeightExaggeration -",
|
|
GuiPath = "/New Horizons",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "CTRL+L",
|
|
Command = propertyHelper.decrement('Scene.CharonProjection.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.PlutoBarycentricTrail.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
|
|
},
|
|
{
|
|
Key = "h",
|
|
Name="Hide Trails",
|
|
Command = "local list = openspace.getProperty('*Trail.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end",
|
|
Documentation = "Disables visibility of the trails",
|
|
GuiPath = "/Rendering",
|
|
Local = false
|
|
},
|
|
|
|
}
|
|
|
|
|
|
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 = "PlutoProjection"
|
|
},
|
|
{
|
|
Type = "DashboardItemInstruments",
|
|
Identifier = "NewHorizonsInstruments",
|
|
GuiName = "NewHorizons Instruments",
|
|
}
|
|
})
|
|
|
|
asset.onInitialize(function ()
|
|
openspace.time.setTime("2015-07-14T08:00:00.00")
|
|
sceneHelper.bindKeys(Keybindings)
|
|
|
|
openspace.markInterestingNodes({ "Pluto", "NewHorizons", "Charon" })
|
|
|
|
sceneHelper.setDeltaTimeKeys({
|
|
1, 5, 10, 20, 40, 60, 120, 360, 540, 1080,
|
|
2160, 4320, 8640
|
|
})
|
|
|
|
openspace.setPropertyValueSingle('NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance', 20.000000);
|
|
openspace.setPropertyValueSingle('Scene.Pluto.Renderable.Enabled', false)
|
|
openspace.setPropertyValueSingle('Scene.Charon.Renderable.Enabled', false)
|
|
openspace.setPropertyValueSingle("Scene.PlutoBarycenterTrail.Renderable.Enabled", false)
|
|
|
|
openspace.navigation.setNavigationState({
|
|
Anchor = "NewHorizons",
|
|
ReferenceFrame = "Root",
|
|
Position = { -6.572656E1, -7.239404E1, -2.111890E1 },
|
|
Up = { 0.102164, -0.362945, 0.926193 }
|
|
})
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
sceneHelper.unbindKeys(Keybindings)
|
|
|
|
openspace.removeInterestingNodes({ "Pluto", "NewHorizons", "Charon" })
|
|
|
|
openspace.setPropertyValueSingle('Scene.Pluto.Renderable.Enabled', true)
|
|
openspace.setPropertyValueSingle('Scene.Charon.Renderable.Enabled', true)
|
|
openspace.setPropertyValueSingle('Scene.PlutoBarycenterTrail.Renderable.Enabled', true)
|
|
end)
|