Files
OpenSpace/data/assets/rosetta.scene

153 lines
5.0 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/rosetta/67p')
asset.require('scene/solarsystem/missions/rosetta/rosetta')
-- 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', '67P')",
Documentation = "Sets the focus of the camera on '67P'.",
Local = false
},
{
Key = "s",
Command = "openspace.setPropertyValue('NavigationHandler.Origin', 'Rosetta')",
Documentation = "Sets the focus of the camera on 'Rosetta'",
Local = false
},
{
Key = "F5",
Command = "openspace.time.setTime('2014-08-01T03:05:18.101')",
Documentation = "Jumps to the time of initial approach of Rosetta to 67P.",
Local = false
},
{
Key = "F6",
Command = "openspace.time.setTime('2014-11-12T08:20:00.00')",
Documentation = "Jumps to the time when the Philae lander is released.",
Local = false
},
{
Key = "F8",
Command = "openspace.setPropertyValue('Scene.67P.Renderable.ProjectionComponent.clearAllProjections', true)",
Documentation = "Removes all image projections from 67P.",
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 = renderableHelper.toggle('Scene.JupiterTrail') .. renderableHelper.toggle('Scene.SaturnTrail') ..
renderableHelper.toggle('Scene.UranusTrail') .. renderableHelper.toggle('Scene.NeptuneTrail'),
Documentation = "Toggles the visibility of all trails further from the Sun than 67P.",
Local = false
},
{
Key = "i",
Command = renderableHelper.toggle('Scene.ImagePlaneRosetta'),
Documentation = "Toggles the visibility of the free floating image plane.",
Local = false
},
{
Key = "f",
Command = renderableHelper.toggle('Scene.PhilaeTrail'),
Documentation = "Toggles the visibility of Philae's trail.",
Local = false
},
{
Key = "p",
Command = propertyHelper.invert('Scene.67P.Renderable.ProjectionComponent.performProjection'),
Documentation = "Enables or disables the image projection on 67P.",
Local = false
}
}
local Comet67PAsset = asset.require('scene/solarsystem/missions/rosetta/67p')
assetHelper.registerDashboardItems(asset, {
{
Type = "DashboardItemSpacing",
Identifier = "RosettaSpacing",
GuiName = "Rosetta Spacing",
Spacing = 25
},
{
Type = "DashboardItemDistance",
Identifier = "Rosetta67PDistance",
GuiName = "Rosetta 67P Distance",
SourceType = "Node",
SourceNodeName = "Rosetta",
DestinationType = "Node",
DestinationNodeName = "67P"
},
{
Type = "DashboardItemInstruments",
Identifier = "RosettaInstruments",
GuiName = "Rosetta Instruments",
}
})
assetHelper.registerInterestingNodes(asset, {
"67P", "Rosetta", "Philae"
})
asset.onInitialize(function ()
openspace.time.setTime("2014-08-01T03:05:00.000")
sceneHelper.bindKeys(Keybindings)
openspace.setDefaultGuiSorting()
sceneHelper.setDeltaTimeKeys({
1, 5, 10, 20, 40, 90, 360, 720, 2880, 14400,
28800, 57600, 115200, 230400, 460800, 921600, 1843200, 3686400, 7372800, 14745600
})
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 = Comet67PAsset.Comet67P.Identifier,
Position = { 526781518487.171326, 257168309890.072144, -1381125204152.817383 },
Rotation = { -0.106166, 0.981574, -0.084545, 0.134513 },
})
openspace.setPropertyValue('Scene.67P.Renderable.PerformShading', false);
end)
asset.onDeinitialize(function ()
sceneHelper.unbindKeys(Keybindings)
openspace.removeVirtualProperty("*Trail.Renderable.Enabled")
end)