mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 16:29:43 -05:00
Adding documentation and examples (#3541)
- Make the SourceType and DestinationType parameters required in the DashboardItemAngle - Shift the "UTC" string in the DashboardDate from the FormatString to the TimeFormat - Make the SourceType and DestinationType parameters for the DashboardItemDistance required - Add new "Deltatime" option to the DashboardItemFramerate. Add examples for the DashboardItemFramerate - Fix issue where the inputstate would not update if no option was selected - Automatically disable simplification if a unit is requested in the asset for a DashboardItemSimulationIncrement or DashboardItemVelocity
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
local Item = {
|
||||
Type = "DashboardItemDistance",
|
||||
Identifier = "Distance",
|
||||
GuiName = "Distance"
|
||||
GuiName = "Distance",
|
||||
SourceType = "Camera",
|
||||
DestinationType = "Focus"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
-- Three nodes
|
||||
-- This example adds three invisible scene graph nodes and then shows the angle between
|
||||
-- those three nodes.
|
||||
|
||||
local Node1 = {
|
||||
Identifier = "DashboardItemAngle_Example_ThreeNodes_Node1",
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Three Nodes (Node 1)"
|
||||
}
|
||||
}
|
||||
|
||||
local Node2 = {
|
||||
Identifier = "DashboardItemAngle_Example_ThreeNodes_Node2",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 2.0, 1.0, 0.0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Three Nodes (Node 2)"
|
||||
}
|
||||
}
|
||||
|
||||
local Node3 = {
|
||||
Identifier = "DashboardItemAngle_Example_ThreeNodes_Node3",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { -2.0, 1.0, 0.0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Three Nodes (Node 3)"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemAngle_Example_ThreeNodes",
|
||||
Type = "DashboardItemAngle",
|
||||
SourceType = "Node",
|
||||
SourceNodeIdentifier = Node1.Identifier,
|
||||
ReferenceType = "Node",
|
||||
ReferenceNodeIdentifier = Node2.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeIdentifier = Node3.Identifier
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node1)
|
||||
openspace.addSceneGraphNode(Node2)
|
||||
openspace.addSceneGraphNode(Node3)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node3)
|
||||
openspace.removeSceneGraphNode(Node2)
|
||||
openspace.removeSceneGraphNode(Node1)
|
||||
end)
|
||||
@@ -0,0 +1,45 @@
|
||||
-- Two nodes and camera
|
||||
-- This example adds two invisible scene graph nodes and then shows the angle between the
|
||||
-- camera and those two nodes.
|
||||
|
||||
local Node1 = {
|
||||
Identifier = "DashboardItemAngle_Example_TwoNodesCamera_Node1",
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Two Nodes & Camera (Node 1)"
|
||||
}
|
||||
}
|
||||
|
||||
local Node2 = {
|
||||
Identifier = "DashboardItemAngle_Example_TwoNodesCamera_Node2",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 20.0, 1.0, 0.0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Two Nodes & Camera (Node 2)"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemAngle_Example_TwoNodesCamera",
|
||||
Type = "DashboardItemAngle",
|
||||
SourceType = "Camera",
|
||||
ReferenceType = "Node",
|
||||
ReferenceNodeIdentifier = Node1.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeIdentifier = Node2.Identifier
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node1)
|
||||
openspace.addSceneGraphNode(Node2)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node2)
|
||||
openspace.removeSceneGraphNode(Node1)
|
||||
end)
|
||||
@@ -0,0 +1,45 @@
|
||||
-- Two nodes and focus
|
||||
-- This example adds two invisible scene graph nodes and then shows the angle between the
|
||||
-- current focus node and those two nodes.
|
||||
|
||||
local Node1 = {
|
||||
Identifier = "DashboardItemAngle_Example_TwoNodesFocus_Node1",
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Two Nodes & Focus (Node 1)"
|
||||
}
|
||||
}
|
||||
|
||||
local Node2 = {
|
||||
Identifier = "DashboardItemAngle_Example_TwoNodesFocus_Node2",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 20.0, 1.0, 0.0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "DashboardItemAngle - Two Nodes & Focus (Node 2)"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemAngle_Example_TwoNodesFocus",
|
||||
Type = "DashboardItemAngle",
|
||||
SourceType = "Focus",
|
||||
ReferenceType = "Node",
|
||||
ReferenceNodeIdentifier = Node1.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeIdentifier = Node2.Identifier
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node1)
|
||||
openspace.addSceneGraphNode(Node2)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node2)
|
||||
openspace.removeSceneGraphNode(Node1)
|
||||
end)
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Basic
|
||||
-- This example adds a new DashboardItem that shows the current in-game simulation date.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDate_Example",
|
||||
Type = "DashboardItemDate"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Day of Year
|
||||
-- This example adds a new DashboardItem that shows the current in-game simulation date
|
||||
-- showing the current year and the number of days that have passed in the year.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDate_Example_DayOfYear",
|
||||
Type = "DashboardItemDate",
|
||||
TimeFormat = "YYYY DOY"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- No Decorations
|
||||
-- This example adds a new DashboardItem that shows the current in-game simulation date
|
||||
-- without any additional text surrounding the current date
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDate_Example_NoDecoration",
|
||||
Type = "DashboardItemDate",
|
||||
FormatString = "{}"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Timezone
|
||||
-- This example adds a new DashboardItem that shows the current in-game simulation date
|
||||
-- with a timezone of UTC-7 (=PDT)
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDate_Example_Timezone",
|
||||
Type = "DashboardItemDate",
|
||||
TimeFormat = "YYYY MON DD HR:MN:SC.### PDT ::UTC-7"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Year Month Day
|
||||
-- This example adds a new DashboardItem that shows the current in-game simulation date
|
||||
-- with a resolution of days.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDate_Example_YearMonthDay",
|
||||
Type = "DashboardItemDate",
|
||||
TimeFormat = "YYYY MON DD"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,28 @@
|
||||
-- Node-Camera
|
||||
-- This example adds an invisible node and a dashboard item that shows the distance
|
||||
-- between this node and the current focus node.
|
||||
|
||||
local Node = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeCamera_Node",
|
||||
GUI = {
|
||||
Name = "DashboardItemDistance - Node-Camera"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeCamera",
|
||||
Type = "DashboardItemDistance",
|
||||
SourceType = "Node",
|
||||
SourceNodeIdentifier = Node.Identifier,
|
||||
DestinationType = "Camera"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -0,0 +1,28 @@
|
||||
-- Node-Focus
|
||||
-- This example adds an invisible node and a dashboard item that shows the distance
|
||||
-- between this node and the current focus node.
|
||||
|
||||
local Node = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeFocus_Node",
|
||||
GUI = {
|
||||
Name = "DashboardItemDistance - Node-Focus"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeFocus",
|
||||
Type = "DashboardItemDistance",
|
||||
SourceType = "Node",
|
||||
SourceNodeIdentifier = Node.Identifier,
|
||||
DestinationType = "Focus"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node1)
|
||||
end)
|
||||
@@ -0,0 +1,44 @@
|
||||
-- Node-Node
|
||||
-- This example adds two invisible nodes and a dashboard item that shows the distance
|
||||
-- between those two nodes.
|
||||
|
||||
local Node1 = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeNode_Node1",
|
||||
GUI = {
|
||||
Name = "DashboardItemDistance - Node-Node (Node 1)"
|
||||
}
|
||||
}
|
||||
|
||||
local Node2 = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeNode_Node2",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 2.0, 0.0, 0.0 }
|
||||
}
|
||||
},
|
||||
GUI = {
|
||||
Name = "DashboardItemDistance - Node-Node (Node 2)"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeNode",
|
||||
Type = "DashboardItemDistance",
|
||||
SourceType = "Node",
|
||||
SourceNodeIdentifier = Node1.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeIdentifier = Node2.Identifier
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node1)
|
||||
openspace.addSceneGraphNode(Node2)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node2)
|
||||
openspace.removeSceneGraphNode(Node1)
|
||||
end)
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
-- NodeSurface-Camera
|
||||
-- This example adds two invisible nodes and a dashboard item that shows the distance
|
||||
-- between those two nodes
|
||||
|
||||
local Node = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeSurfaceCamera_Node",
|
||||
BoundingSphere = 200.0,
|
||||
GUI = {
|
||||
Name = "DashboardItemDistance - NodeSurface-Camera"
|
||||
}
|
||||
}
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemDistance_Example_NodeSurfaceCamera",
|
||||
Type = "DashboardItemDistance",
|
||||
SourceType = "Node Surface",
|
||||
SourceNodeIdentifier = Node.Identifier,
|
||||
DestinationType = "Camera"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the remaining time or the elapsed time
|
||||
-- since midday 2000 JAN 01.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemElapsedTime_Example",
|
||||
Type = "DashboardItemElapsedTime",
|
||||
ReferenceTime = "2000 JAN 01 12:00:00"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Fixed Time
|
||||
-- This example adds a dashboard item that shows the remaining time or the elapsed time
|
||||
-- since 2000 JAN 01 but ignoring any unit smaller than days.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemElapsedTime_Example_FixedTime",
|
||||
Type = "DashboardItemElapsedTime",
|
||||
ReferenceTime = "2000 JAN 01 12:00:00",
|
||||
LowestTimeUnit = "Day"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,19 @@
|
||||
-- No Decorations
|
||||
-- This example adds a dashboard item that shows the remaining time or the elapsed time
|
||||
-- since midday 2000 JAN 01 without any additional text decoration and only printing the
|
||||
-- remaining time.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemElapsedTime_Example_NoDecorations",
|
||||
Type = "DashboardItemElapsedTime",
|
||||
ReferenceTime = "2000 JAN 01 12:00:00",
|
||||
FormatString = "{}"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the average number of frames per second,
|
||||
-- which is the default value for the frame time type setting.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemFramerate_Example",
|
||||
Type = "DashboardItemFramerate"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Delta Time
|
||||
-- This example adds a dashboard item that shows the frame rate of the last frame in
|
||||
-- milliseconds.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemFramerate_Example_DeltaTime",
|
||||
Type = "DashboardItemFramerate",
|
||||
FrametimeType = "Deltatime"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the position of the camera relative to
|
||||
-- the focus node, if that focus node is a globe.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemGlobeLocation_Example",
|
||||
Type = "DashboardItemGlobeLocation"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Degree/Minute/Seconds
|
||||
-- This example adds a dashboard item that shows the position of the camera relative to
|
||||
-- the focus node, if that focus node is a globe. The longitude and latitude of the camera
|
||||
-- is provided in the sexagesimal system (degrees, minutes, seconds).
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemGlobeLocation_Example",
|
||||
Type = "DashboardItemGlobeLocation",
|
||||
DisplayFormat = "DegreeMinuteSeconds"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the input state of the mouse, keyboard,
|
||||
-- and joystick input devices.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemInputState_Example",
|
||||
Type = "DashboardItemInputState"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Mouse Only
|
||||
-- This example adds a dashboard item that only shows the input state of the mouse inputs.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemInputState_Example_MouseOnly",
|
||||
Type = "DashboardItemInputState",
|
||||
ShowKeyboard = false,
|
||||
ShowJoystick = false
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
-- Only disabled
|
||||
-- This example adds a dashboard item that shows the input state of the mouse, keyboard,
|
||||
-- and joystick input devices but only when they are disabled.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemInputState_Example_OnlyDisabled",
|
||||
Type = "DashboardItemInputState",
|
||||
ShowWhenDisabled = true
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the status of the currently active
|
||||
-- mission.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemMission_Example",
|
||||
Type = "DashboardItemMission"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the status of the parallel connection.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemParallelConnection_Example",
|
||||
Type = "DashboardItemParallelConnection"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
-- Bool
|
||||
-- This example adds a dashboard item that shows the state of a boolean property.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemPropertyValue_Example_Bool",
|
||||
Type = "DashboardItemPropertyValue",
|
||||
URI = "NavigationHandler.OrbitalNavigator.Friction.RotationalFriction",
|
||||
DisplayString = "Rotational Friction is: {}"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
-- Float
|
||||
-- This example adds a dashboard item that shows the state of a floating point value
|
||||
-- property.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemPropertyValue_Example_Float",
|
||||
Type = "DashboardItemPropertyValue",
|
||||
URI = "RenderEngine.Gamma",
|
||||
DisplayString = "Gamma Correction: {}"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Int
|
||||
-- This example adds a dashboard item that shows the state of a integer point value
|
||||
-- property.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemPropertyValue_Example_Int",
|
||||
Type = "DashboardItemPropertyValue",
|
||||
URI = "LuaConsole.HistoryLength",
|
||||
DisplayString = "Lua Console History Length: {}"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
-- Vec3
|
||||
-- This example adds a dashboard item that shows the state of a 3-vector value property.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemPropertyValue_Example_Vec3",
|
||||
Type = "DashboardItemPropertyValue",
|
||||
URI = "RenderEngine.GlobalRotation",
|
||||
DisplayString = "Global Rotation: ({}, {}, {})"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
-- Vec4
|
||||
-- This example adds a dashboard item that shows the state of a 4-vector value property.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemPropertyValue_Example_Vec4",
|
||||
Type = "DashboardItemPropertyValue",
|
||||
URI = "RenderEngine.EnabledFontColor",
|
||||
DisplayString = "Font Color (enabled): ({}, {}, {}, {})"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the current simulation increment.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemSimulationIncrement_Example",
|
||||
Type = "DashboardItemSimulationIncrement"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
-- Nanoseconds
|
||||
-- This example adds a dashboard item that shows the current simulation increment always
|
||||
-- expressed in nanoseconds.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemSimulationIncrement_Example_NoDecoration",
|
||||
Type = "DashboardItemSimulationIncrement",
|
||||
RequestedUnit = "Nanosecond"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
-- No Decoration
|
||||
-- This example adds a dashboard item that shows the current simulation increment without
|
||||
-- any textual decorations. This example also shows how to ignore the first two parameters
|
||||
-- the `TransitionFormat` format string. Both the `TransitionFormat` and the
|
||||
-- `RegularFormat` string replacement markers allow the setting of numbers to determine
|
||||
-- which argument should be placed in here. The `TransitionFormat` in this example omits
|
||||
-- the numbers 0 and 1, thus ignoring the first two arguments to the string.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemSimulationIncrement_Example_NoDecoration",
|
||||
Type = "DashboardItemSimulationIncrement",
|
||||
TransitionFormat = "{3:.1f} {4:s} / second{2:s}",
|
||||
RegularFormat = "{:.1f} {:s} / second{:s}"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that adds a spacing to the dashboard. This example
|
||||
-- will not show anything by itself.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemSpacing_Example",
|
||||
Type = "DashboardItemSpacing"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Basic
|
||||
-- This example adds a dashboard item that shows the speed of the camera.
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemVelocity_Example",
|
||||
Type = "DashboardItemVelocity"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Nautical Miles
|
||||
-- This example adds a dashboard item that shows the speed of the camera, but always
|
||||
-- displayed in nautical miles per second (or knots).
|
||||
|
||||
local Item = {
|
||||
Identifier = "DashboardItemVelocity_Example_NauticalMiles",
|
||||
Type = "DashboardItemVelocity",
|
||||
RequestedUnit = "Nautical Mile"
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Item)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(Item)
|
||||
end)
|
||||
@@ -1,201 +0,0 @@
|
||||
asset.require("scene/solarsystem/planets/earth/earth")
|
||||
asset.require("scene/solarsystem/planets/earth/moon/moon")
|
||||
|
||||
local Angle = {
|
||||
Type = "DashboardItemAngle",
|
||||
Identifier = "Angle",
|
||||
ReferenceType = "Node",
|
||||
ReferenceNodeName = "Earth",
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = "Moon"
|
||||
}
|
||||
|
||||
local Date = {
|
||||
Type = "DashboardItemDate",
|
||||
Identifier = "Date"
|
||||
}
|
||||
|
||||
local SimulationIncrement = {
|
||||
Type = "DashboardItemSimulationIncrement",
|
||||
Identifier = "SimulationIncrement",
|
||||
GuiName = "Simulation Increment"
|
||||
}
|
||||
|
||||
local Distance = {
|
||||
Type = "DashboardItemDistance",
|
||||
Identifier = "Distance"
|
||||
}
|
||||
|
||||
local Framerate = {
|
||||
Type = "DashboardItemFramerate",
|
||||
Identifier = "Framerate"
|
||||
}
|
||||
|
||||
local ParallelConnection = {
|
||||
Type = "DashboardItemParallelConnection",
|
||||
Identifier = "ParallelConnection",
|
||||
GuiName = "Parallel Connection"
|
||||
}
|
||||
|
||||
local Mission = {
|
||||
Type = "DashboardItemMission",
|
||||
Identifier = "Mission"
|
||||
}
|
||||
|
||||
local PropertyValue = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashbaordItemPropertyValue",
|
||||
URI = "Scene.Earth.Renderable.Enabled",
|
||||
DisplayString = "Earth is enabled: {}"
|
||||
}
|
||||
|
||||
local PropertyValueFloat = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashbaordItemPropertyValue_Float",
|
||||
URI = "Scene.Earth.Renderable.TargetLodScaleFactor",
|
||||
DisplayString = "Earth LOD is {:.5f}"
|
||||
}
|
||||
|
||||
local PropertyValueDouble = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashbaordItemPropertyValue_Double",
|
||||
URI = "NavigationHandler.PathNavigator.ArrivalDistanceFactor",
|
||||
DisplayString = "Arrival Distance Factor is {:.8f}"
|
||||
}
|
||||
|
||||
local PropertyValueInt = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashbaordItemPropertyValue_Int",
|
||||
URI = "LuaConsole.HistoryLength",
|
||||
DisplayString = "History length is {}"
|
||||
}
|
||||
|
||||
local PropertyValueUInt = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashboardItemPropertyValue_UInt",
|
||||
URI = "Modules.Globebrowsing.TileCacheSize",
|
||||
DisplayString = "Tile Cache Size is {}"
|
||||
}
|
||||
|
||||
local PropertyValueDVec3 = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashboardItemPropertyValue_DVec3",
|
||||
URI = "Scene.SolarSystemBarycenter.Transform.Transform",
|
||||
DisplayString = "SSB Transform is: ({}, {}, {})"
|
||||
}
|
||||
|
||||
local PropertyValueIVec2 = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashboardItemPropertyValue_IVec2",
|
||||
URI = "Scene.SolarSystemBarycenter.Renderable.ScreenSpacePosition",
|
||||
DisplayString = "Random ScreenSpace Position: ({}, {})"
|
||||
}
|
||||
|
||||
local PropertyValueVec2 = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashboardItemPropertyValue_Vec2",
|
||||
URI = "Scene.EarthAtmosphere.Renderable.AtmosphereDimmingSunsetAngle",
|
||||
DisplayString = "Sunset Angle is ({}, {})"
|
||||
}
|
||||
|
||||
local PropertyValueVec3 = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashboardItemPropertyValue_Vec3",
|
||||
URI = "RenderEngine.GlobalRotation",
|
||||
DisplayString = "Global Rotation is ({}, {}, {})"
|
||||
}
|
||||
|
||||
local PropertyValueVec4 = {
|
||||
Type = "DashboardItemPropertyValue",
|
||||
Identifier = "DashboardItemPropertyValue_Vec4",
|
||||
URI = "LuaConsole.BackgroundColor",
|
||||
DisplayString = "Background Coolor is ({}, {}, {}, {})"
|
||||
}
|
||||
|
||||
local ElapsedTime = {
|
||||
Type = "DashboardItemElapsedTime",
|
||||
Identifier = "ElapsedTime",
|
||||
ReferenceTime = "2022-10-12 12:00:00"
|
||||
}
|
||||
|
||||
local InputState = {
|
||||
Type = "DashboardItemInputState",
|
||||
Identifier = "InputState"
|
||||
}
|
||||
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.dashboard.addDashboardItem(Angle)
|
||||
openspace.dashboard.addDashboardItem(Date)
|
||||
openspace.dashboard.addDashboardItem(SimulationIncrement)
|
||||
openspace.dashboard.addDashboardItem(Distance)
|
||||
openspace.dashboard.addDashboardItem(Framerate)
|
||||
openspace.dashboard.addDashboardItem(ParallelConnection)
|
||||
openspace.dashboard.addDashboardItem(Mission)
|
||||
openspace.dashboard.addDashboardItem(PropertyValue)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueFloat)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueDouble)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueInt)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueUInt)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueDVec3)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueIVec2)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueVec2)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueVec3)
|
||||
openspace.dashboard.addDashboardItem(PropertyValueVec4)
|
||||
openspace.dashboard.addDashboardItem(ElapsedTime)
|
||||
openspace.dashboard.addDashboardItem(InputState)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.dashboard.removeDashboardItem(InputState)
|
||||
openspace.dashboard.removeDashboardItem(ElapsedTime)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueVec4)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueVec3)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueVec2)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueIVec2)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueDVec3)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueUInt)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueInt)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueDouble)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValueFloat)
|
||||
openspace.dashboard.removeDashboardItem(PropertyValue)
|
||||
openspace.dashboard.removeDashboardItem(Mission)
|
||||
openspace.dashboard.removeDashboardItem(ParallelConnection)
|
||||
openspace.dashboard.removeDashboardItem(Framerate)
|
||||
openspace.dashboard.removeDashboardItem(Distance)
|
||||
openspace.dashboard.removeDashboardItem(SimulationIncrement)
|
||||
openspace.dashboard.removeDashboardItem(Date)
|
||||
openspace.dashboard.removeDashboardItem(Angle)
|
||||
end)
|
||||
|
||||
asset.export(Angle)
|
||||
asset.export(Date)
|
||||
asset.export(SimulationIncrement)
|
||||
asset.export(Distance)
|
||||
asset.export(Framerate)
|
||||
asset.export(ParallelConnection)
|
||||
asset.export(Mission)
|
||||
asset.export(PropertyValue)
|
||||
asset.export(PropertyValueFloat)
|
||||
asset.export(PropertyValueDouble)
|
||||
asset.export(PropertyValueInt)
|
||||
asset.export(PropertyValueUInt)
|
||||
asset.export(PropertyValueDVec3)
|
||||
asset.export(PropertyValueIVec2)
|
||||
asset.export(PropertyValueVec2)
|
||||
asset.export(PropertyValueVec3)
|
||||
asset.export(PropertyValueVec4)
|
||||
asset.export(ElapsedTime)
|
||||
asset.export(InputState)
|
||||
|
||||
|
||||
|
||||
asset.meta = {
|
||||
Name = "Dashboard Items Example",
|
||||
Description = [[Examples of different types of dashboard items. These are dynamic
|
||||
information texts that will be shown over the rendering (per default in the top
|
||||
left corner, on flat screens).]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "http://openspaceproject.com",
|
||||
License = "MIT license"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Basic
|
||||
-- This example creates a SceneGraphNode that only displays coordinate axes. The
|
||||
-- parent is not set which defaults to placing the axes at the center of the Sun.
|
||||
-- This example creates a scene graph node that only displays coordinate axes. The parent
|
||||
-- is not set which defaults to placing the axes at the center of the Sun.
|
||||
|
||||
local Node = {
|
||||
Identifier = "RenderableCartesianAxes_Example",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- With Parent
|
||||
-- This example creates a SceneGraphNode that displays coordinate axes of the given parent
|
||||
-- node, in this case Earth.
|
||||
-- This example creates a scene graph node that displays coordinate axes of the given
|
||||
-- parent node, in this case Earth.
|
||||
|
||||
local earth = asset.require("scene/solarsystem/planets/earth/earth")
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
-- Basic
|
||||
-- This example shows how to create a textured plane in 3D space, where the texture is
|
||||
-- loaded from a local file on disk.
|
||||
|
||||
local Node = {
|
||||
Identifier = "RenderablePlaneImageLocal_Example",
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneImageLocal",
|
||||
Size = 3.0E11,
|
||||
Texture = openspace.absPath("${DATA}/test2.jpg")
|
||||
},
|
||||
GUI = {
|
||||
Name = "RenderablePlaneImageLocal - Basic",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
-- Billboard Image
|
||||
-- This example shows how to create a textured plane in 3D space, where the texture is
|
||||
-- loaded from a local file on disk and the plane is billboarded to always face the
|
||||
-- camera.
|
||||
|
||||
local Node = {
|
||||
Identifier = "RenderablePlaneImageLocal_Example_Billboard",
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneImageLocal",
|
||||
Size = 3.0E11,
|
||||
Texture = openspace.absPath("${DATA}/test2.jpg"),
|
||||
Billboard = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "RenderablePlaneImageLocal - Billboard",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
+4
-4
@@ -1,18 +1,18 @@
|
||||
-- Billboarded Image
|
||||
-- Billboard Image
|
||||
-- This example shows how to create a textured plane in 3D space, where the texture is
|
||||
-- loaded from the internet though a web URL and the plane is billboarded to always
|
||||
-- face the camera.
|
||||
|
||||
local Node = {
|
||||
Identifier = "RenderablePlaneImageOnline_Example_Billboarded",
|
||||
Identifier = "RenderablePlaneImageOnline_Example_Billboard",
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneImageOnline",
|
||||
Size = 3.0E11,
|
||||
URL = "http://data.openspaceproject.com/examples/renderableplaneimageonline.jpg",
|
||||
Billboarded = true
|
||||
Billboard = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "RenderablePlaneImageOnline - Billboarded",
|
||||
Name = "RenderablePlaneImageOnline - Billboard",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
-- Basic
|
||||
-- This asset creates a rotation that places coordinate axes close to a sphere with the
|
||||
-- z axis pointing towards the sphere. The coordinate axes are translated away from the
|
||||
-- sphere to make that orientation more obvious.
|
||||
--
|
||||
-- Making the `YAxis` `{ 0.0, 1.0, 0.0 }` and actually using the orthogonal projection of
|
||||
-- that direction means that the y axis of the new coordinate system will point in the
|
||||
-- hemisphere in which the old y-axis was pointing, albeit being orthogonal to the other
|
||||
-- specified axis. That axis is pointing towards the scene graph node holding the sphere.
|
||||
|
||||
local Sphere = {
|
||||
Identifier = "FixedRotation_Example_Sphere",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 2.0, 1.5, 1.0 }
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Basic (Sphere)",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
local Node = {
|
||||
Identifier = "FixedRotation_Example",
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "FixedRotation_Example",
|
||||
YAxis = { 0.0, 1.0, 0.0 },
|
||||
YAxisOrthogonal = true,
|
||||
ZAxis = "FixedRotation_Example_Sphere"
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Basic",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Sphere)
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
openspace.removeSceneGraphNode(Sphere)
|
||||
end)
|
||||
@@ -0,0 +1,33 @@
|
||||
-- Axis Mapping
|
||||
-- This asset creates a rotation that shows coordinate axes in which the x and the y axes
|
||||
-- are flipped. While this could also be achieved with a
|
||||
-- [ConstantRotation](#base_transform_rotation_constant) class, this serves as an example
|
||||
-- for more elaborate coordinate system mappings, such as converting to a coordinate
|
||||
-- system with a known coordinate axes.
|
||||
|
||||
local Node = {
|
||||
Identifier = "FixedRotation_Example_Mapping",
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
XAxis = { 0.0, 1.0, 0.0 },
|
||||
YAxis = { 1.0, 0.0, 0.0 },
|
||||
ZAxis = { 0.0, 0.0, 1.0 }
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Mapping",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -0,0 +1,56 @@
|
||||
-- Inverted Axis
|
||||
-- This asset creates a rotation that places coordinate axes close to a sphere with the z
|
||||
-- axis pointing away from the sphere. The coordinate axes are translated away from the
|
||||
-- sphere to make that orientation more obvious.
|
||||
--
|
||||
-- Making the `YAxis` { 0.0, 1.0, 0.0 } and actually using the orthogonal projection of
|
||||
-- that direction means that the y axis of the new coordinate system will point in the
|
||||
-- hemisphere in which the old y-axis was pointing, albeit being orthogonal to the other
|
||||
-- specified axis. That axis is pointing towards the scene graph node holding the sphere.
|
||||
local Sphere = {
|
||||
Identifier = "FixedRotation_Example_InvertedAxis_Sphere",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 2.0, 1.5, 1.0 }
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Inverted Axis (Sphere)",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
local Node = {
|
||||
Identifier = "FixedRotation_Example_InvertedAxis",
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "FixedRotation_Example_InvertedAxis",
|
||||
YAxis = { 0.0, 1.0, 0.0 },
|
||||
YAxisOrthogonal = true,
|
||||
ZAxis = Sphere.Identifier,
|
||||
ZAxisInvert = true
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Inverted Axis",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Sphere)
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
openspace.removeSceneGraphNode(Sphere)
|
||||
end)
|
||||
@@ -0,0 +1,87 @@
|
||||
-- Rotation Following Two Moving Objects
|
||||
-- This asset creates a rotation that places coordinate axes orbiting close to two spheres
|
||||
-- with the y axis always pointing towards the first sphere and the z axis always pointing
|
||||
-- towards the second sphere as the coordinate system moves around. The set of coordinate
|
||||
-- axes are orbiting using a [KeplerTranslation](#space_transform_kepler) that provides a
|
||||
-- configurable orbital motion. The use of the
|
||||
-- [KeplerTranslation](#space_transform_kepler) in this example is arbitrary and the
|
||||
-- FixedRotation does not depend on the use of that class. We use it in this example as we
|
||||
-- want a moving object to show that the `FixedRotation` will always point at the object,
|
||||
-- even as it is moving.
|
||||
--
|
||||
-- Note that in this example the coordinate system will be skewed as, in general, it is
|
||||
-- not guaranteed that the direction from the node to the two spheres will be an
|
||||
-- orthogonal vector.
|
||||
|
||||
local Sphere1 = {
|
||||
Identifier = "FixedRotation_Example_Moving_TwoObjects_Sphere1",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 3.0, -2.0, 0.0 }
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Moving Two Objects (Sphere 1)",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
local Sphere2 = {
|
||||
Identifier = "FixedRotation_Example_Moving_TwoObjects_Sphere2",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "KeplerTranslation",
|
||||
Eccentricity = 0.5,
|
||||
SemiMajorAxis = 0.0025,
|
||||
Inclination = 0.0,
|
||||
AscendingNode = 0.0,
|
||||
ArgumentOfPeriapsis = 0.0,
|
||||
MeanAnomaly = 0.0,
|
||||
Epoch = "2000 JAN 01 12:00:00",
|
||||
Period = 10.0
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Moving Two Objects (Sphere 2)",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
local Node = {
|
||||
Identifier = "FixedRotation_Example_Moving_TwoObjects",
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "FixedRotation_Example_Moving_TwoObjects",
|
||||
YAxis = Sphere1.Identifier,
|
||||
YAxisOrthogonal = true,
|
||||
ZAxis = Sphere2.Identifier
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Moving Two Objects",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Sphere1)
|
||||
openspace.addSceneGraphNode(Sphere2)
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
openspace.removeSceneGraphNode(Sphere2)
|
||||
openspace.removeSceneGraphNode(Sphere1)
|
||||
end)
|
||||
@@ -0,0 +1,63 @@
|
||||
-- Rotation Following One Moving Object
|
||||
-- This asset creates a rotation that places coordinate axes orbiting close to a sphere
|
||||
-- with the z axis always pointing towards the sphere as it orbits around the sphere. The
|
||||
-- coordinate axes are translated away from the sphere to make that orientation more
|
||||
-- obvious.
|
||||
--
|
||||
-- Making the `YAxis` { 0.0, 1.0, 0.0 } and actually using the orthogonal projection of
|
||||
-- that direction means that the y axis of the new coordinate system will point in the
|
||||
-- hemisphere in which the old y-axis was pointing, albeit being orthogonal to the other
|
||||
-- specified axis. That axis is pointing towards the scene graph node holding the sphere.
|
||||
local Sphere = {
|
||||
Identifier = "FixedRotation_Example_Moving_Sphere",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "KeplerTranslation",
|
||||
Eccentricity = 0.5,
|
||||
SemiMajorAxis = 0.0025,
|
||||
Inclination = 0.0,
|
||||
AscendingNode = 0.0,
|
||||
ArgumentOfPeriapsis = 0.0,
|
||||
MeanAnomaly = 0.0,
|
||||
Epoch = "2000 JAN 01 12:00:00",
|
||||
Period = 10.0
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Moving (Sphere)",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
local Node = {
|
||||
Identifier = "FixedRotation_Example_Moving",
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "FixedRotation_Example_Moving",
|
||||
YAxis = { 0.0, 1.0, 0.0 },
|
||||
YAxisOrthogonal = true,
|
||||
ZAxis = Sphere.Identifier
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "FixedRotation - Moving",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Sphere)
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
openspace.removeSceneGraphNode(Sphere)
|
||||
end)
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The rotation of
|
||||
-- coordinate axes are determined by executing a Lua file that returns the rotation matrix
|
||||
-- to be used.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The rotation
|
||||
-- of coordinate axes are determined by executing a Lua file that returns the rotation
|
||||
-- matrix to be used.
|
||||
--
|
||||
-- ```{literalinclude} example.lua
|
||||
-- :language: lua
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The rotation of
|
||||
-- the coordinate axes are determined by a combination of individual rotations. The
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The rotation
|
||||
-- of the coordinate axes are determined by a combination of individual rotations. The
|
||||
-- rotations are applied in the order in which they are specified
|
||||
|
||||
local Node = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
-- Basic
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
|
||||
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
|
||||
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
|
||||
-- at the same rate as Earth.
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a scene
|
||||
-- graph node that only displays coordinate axes. The rotation of the coordinate axes are
|
||||
-- determined by SPICE, in this case pretending that the coordinate axes are rotating at
|
||||
-- the same rate as Earth.
|
||||
-- For more information about SPICE see: https://naif.jpl.nasa.gov/naif/
|
||||
|
||||
-- Load the default SPICE kernels, which are the planetary constants and the DE430 kernel
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
-- Fixed Date
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
|
||||
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
|
||||
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
|
||||
-- at the same rate as Earth. In this specific example, the orientation is independent of
|
||||
-- the actual in-game time in OpenSpace and only uses a fixed date of 2000 JAN 01 instead.
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a scene
|
||||
-- graph node that only displays coordinate axes. The rotation of the coordinate axes are
|
||||
-- determined by SPICE, in this case pretending that the coordinate axes are rotating at
|
||||
-- the same rate as Earth. In this specific example, the orientation is independent of the
|
||||
-- actual in-game time in OpenSpace and only uses a fixed date of 2000 JAN 01 instead.
|
||||
|
||||
-- Load the default SPICE kernels, which is the planetary constants and the DE430 kernel
|
||||
asset.require("spice/core")
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
-- TimeFrame
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
|
||||
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
|
||||
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
|
||||
-- at the same rate as Earth. In this example, the rotation is only calculated between
|
||||
-- 2000 JAN 01 and 2002 JAN 01 to exemplify a use-case in which the data from the SPICE
|
||||
-- kernel is not available for the whole duration.
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a scene
|
||||
-- graph node that only displays coordinate axes. The rotation of the coordinate axes are
|
||||
-- determined by SPICE, in this case pretending that the coordinate axes are rotating at
|
||||
-- the same rate as Earth. In this example, the rotation is only calculated between 2000
|
||||
-- JAN 01 and 2002 JAN 01 to exemplify a use-case in which the data from the SPICE kernel
|
||||
-- is not available for the whole duration.
|
||||
|
||||
-- Load the default SPICE kernels, which is the planetary constants and the DE430 kernel
|
||||
asset.require("spice/core")
|
||||
@@ -1,8 +1,8 @@
|
||||
-- Time offset
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a
|
||||
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
|
||||
-- are determined by SPICE, in this case pretending that the coordinate axes are rotating
|
||||
-- at the same rate as Earth. In this specific example, the orientation is offset 8h back
|
||||
-- This asset creates a rotation provided by a SPICE kernel and applies it to a scene
|
||||
-- graph node that only displays coordinate axes. The rotation of the coordinate axes are
|
||||
-- determined by SPICE, in this case pretending that the coordinate axes are rotating at
|
||||
-- the same rate as Earth. In this specific example, the orientation is offset 8h back
|
||||
-- compared to the actual in-game time in OpenSpace.
|
||||
|
||||
-- Load the default SPICE kernels, which is the planetary constants and the DE430 kernel
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
-- Euler Angles
|
||||
-- This asset creates a rotation provided by Euler angles and applies it to a
|
||||
-- SceneGraphNode that only displays coordinate axes. The rotation of the coordinate axes
|
||||
-- are determined by a constant and unchanging static rotation.
|
||||
-- This asset creates a rotation provided by Euler angles and applies it to a scene graph
|
||||
-- node that only displays coordinate axes. The rotation of the coordinate axes are
|
||||
-- determined by a constant and unchanging static rotation.
|
||||
|
||||
local Node = {
|
||||
Identifier = "StaticRotation_Example_Euler",
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
-- Matrix
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The rotation of
|
||||
-- the coordinate axes are determined by a constant and unchanging static rotation that is
|
||||
-- provided by a 3-by-3 rotation matrix in column-major order.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The rotation
|
||||
-- of the coordinate axes are determined by a constant and unchanging static rotation that
|
||||
-- is provided by a 3-by-3 rotation matrix in column-major order.
|
||||
|
||||
local Node = {
|
||||
Identifier = "StaticRotation_Example_Matrix",
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
-- Quaternion
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The rotation of
|
||||
-- the coordinate axes are determined by a constant and unchanging static rotation that is
|
||||
-- provided by a four-dimensional quaternion.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The rotation
|
||||
-- of the coordinate axes are determined by a constant and unchanging static rotation that
|
||||
-- is provided by a four-dimensional quaternion.
|
||||
|
||||
local Node = {
|
||||
Identifier = "StaticRotation_Example_Quaternion",
|
||||
@@ -1,9 +1,9 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The rotation of
|
||||
-- the coordinate axes are determined by a timeline of individual rotations. These rotations
|
||||
-- are keyframes that are used to seamlessly change between different orientations. This
|
||||
-- example transitions between three rotations over a long time span. This example will
|
||||
-- only work if the in-game time is set to January 1st, 2000.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The rotation
|
||||
-- of the coordinate axes are determined by a timeline of individual rotations. These
|
||||
-- rotations are keyframes that are used to seamlessly change between different
|
||||
-- orientations. This example transitions between three rotations over a long time span.
|
||||
-- This example will only work if the in-game time is set to January 1st, 2000.
|
||||
|
||||
local Node = {
|
||||
Identifier = "TimelineRotation_Example",
|
||||
|
||||
+9
-9
@@ -1,13 +1,13 @@
|
||||
-- No Interpolation
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The rotation of
|
||||
-- the coordinate axes are determined by a timeline of individual rotations that are used
|
||||
-- without interpolating between the timeline entries. These rotations are keyframes that
|
||||
-- are used to change between different orientations. This example transitions between
|
||||
-- three rotations. In this example, the interpolation between entries is disabled, which
|
||||
-- will cause the coordinate axes to change their orientation abruptly when the rotation
|
||||
-- changes. If the interpolation were enabled, the orientation of the coordinate axes
|
||||
-- would transition seamlessly instead at the provided times. This example will only work
|
||||
-- if the in-game time is set to January 1st, 2000.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The rotation
|
||||
-- of the coordinate axes are determined by a timeline of individual rotations that are
|
||||
-- used without interpolating between the timeline entries. These rotations are keyframes
|
||||
-- that are used to change between different orientations. This example transitions
|
||||
-- between three rotations. In this example, the interpolation between entries is
|
||||
-- disabled, which will cause the coordinate axes to change their orientation abruptly
|
||||
-- when the rotation changes. If the interpolation were enabled, the orientation of the
|
||||
-- coordinate axes would transition seamlessly instead at the provided times. This example
|
||||
-- will only work if the in-game time is set to January 1st, 2000.
|
||||
|
||||
local Node = {
|
||||
Identifier = "TimelineRotation_Example_NoInterpolation",
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The sizes of
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The sizes of
|
||||
-- coordinate axes are determined by executing a Lua file that returns the scaling
|
||||
-- parameters to be used as a table.
|
||||
--
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes, with a set of
|
||||
-- This asset creates a scene graph node that only displays coordinate axes, with a set of
|
||||
-- multiple scales that are applied one after the other.
|
||||
|
||||
local Node = {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The coordinate
|
||||
-- axis normally have a length of 1 meter and are scaled in this example by different
|
||||
-- values for each axis. The x axis is scaled by a factor of 149597870700, which means
|
||||
-- they will be 149597870700 m (1 AU) long and thus reaching the same distance as Earth's
|
||||
-- orbit around the Sun. The y-axis stays at its original size, and the z-axis will be
|
||||
-- hidden entirely by setting the scale value close to 0.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The
|
||||
-- coordinate axis normally have a length of 1 meter and are scaled in this example by
|
||||
-- different values for each axis. The x axis is scaled by a factor of 149597870700, which
|
||||
-- means they will be 149597870700 m (1 AU) long and thus reaching the same distance as
|
||||
-- Earth's orbit around the Sun. The y-axis stays at its original size, and the z-axis
|
||||
-- will be hidden entirely by setting the scale value close to 0.
|
||||
|
||||
local Node = {
|
||||
Identifier = "NonUniformStaticScale_Example",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Ellipsoid
|
||||
-- This asset creates a SceneGraphNode that is rendering a sphere which is adjust to an
|
||||
-- This asset creates a scene graph node that is rendering a sphere which is adjust to an
|
||||
-- ellipsoidal shape by using a non-uniform scaling. In particular, the second axis is
|
||||
-- half as long as the first, and the third axis is a third as long.
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The coordinate
|
||||
-- axis normally have a length of 1 meter and are scaled in this example by a factor of
|
||||
-- 149597870700, which means they will be 149597870700 m (1 AU) long, thus reaching the
|
||||
-- same distance as Earth's orbit around the Sun.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The
|
||||
-- coordinate axis normally have a length of 1 meter and are scaled in this example by a
|
||||
-- factor of 149597870700, which means they will be 149597870700 m (1 AU) long, thus
|
||||
-- reaching the same distance as Earth's orbit around the Sun.
|
||||
|
||||
local Node = {
|
||||
Identifier = "StaticScale_Example",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes, which grow at
|
||||
-- This asset creates a scene graph node that only displays coordinate axes, which grow at
|
||||
-- a speed of 1 m/s starting on January 1st, 2000 00:00:00. This means that on
|
||||
-- that date, the coordinate axes will disappear and, for example, on January 1st, 2000
|
||||
-- 12:00:00, the coordinate axes will be 43200 meters long.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- with Speed
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes, which grow at
|
||||
-- This asset creates a scene graph node that only displays coordinate axes, which grow at
|
||||
-- a speed of 12 km/s starting on August 8th, 1969 12:00:00. This means that on
|
||||
-- that date, the coordinate axes will disappear and, for example, on August 8th, 1969
|
||||
-- 23:00:00, the coordinate axes will be 475200 km long.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- No Interpolation
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The scale of
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The scale of
|
||||
-- the coordinate axes are determined by a timeline of individual scales that are used
|
||||
-- without interpolating between the timeline entries. These scales are keyframes that are
|
||||
-- used to change between different sizes. This example transitions between three sizes.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The scale of
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The scale of
|
||||
-- the coordinate axes are determined by a timeline of individual scales. These scales
|
||||
-- are keyframes that are used to seamlessly change between different sizes. This example
|
||||
-- transitions between three scales over a long time span. This example will only work if
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
-- No Interpolation
|
||||
-- This asset creates a scene graph node that only displays coordinate axes whose scale is
|
||||
-- determined by a timeline of individual scales that are used without interpolating
|
||||
-- between the timeline entries. These scales are keyframes that are used to change
|
||||
-- between different sizes.
|
||||
--
|
||||
-- This example transitions between three sizes, but as the interpolation between entries
|
||||
-- is disabled, it will cause the coordinate axes to change their size abruptly when the
|
||||
-- scale changes. If the interpolation were enabled, the orientation of the coordinate
|
||||
-- axes would transition seamlessly instead at the provided times. This example will only
|
||||
-- work if the in-game time is set to January 1st, 2000.
|
||||
|
||||
local Node = {
|
||||
Identifier = "TimelineScale_Example_NoInterpolation",
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "TimelineScale",
|
||||
Keyframes = {
|
||||
-- The first timeline entry
|
||||
["2000 JAN 01 00:00:00"] = {
|
||||
Type = "StaticScale",
|
||||
Scale = 10.0
|
||||
},
|
||||
-- The second timeline entry
|
||||
["2000 JAN 01 12:00:00"] = {
|
||||
Type = "StaticScale",
|
||||
Scale = 0.0
|
||||
},
|
||||
-- The third timeline entry
|
||||
["2000 JAN 01 23:59:59"] = {
|
||||
Type = "StaticScale",
|
||||
Scale = -10.0
|
||||
}
|
||||
},
|
||||
ShouldInterpolate = false
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "TimelineScale - No Interpolation",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -16,7 +16,7 @@ local Dashboard = {
|
||||
FontSize = 40,
|
||||
SourceType = "Camera",
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = earth.Earth.Identifier,
|
||||
DestinationNodeIdentifier = earth.Earth.Identifier,
|
||||
-- Specify to use a specific unit, by disabling the automatic simplification of
|
||||
-- unit and instead use light-years
|
||||
Simplification = false,
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
-- Basic
|
||||
-- This example creates time frame interval and uses it for a scene graph node displaying
|
||||
-- a set of coordinate axes. The time frame interval causes the scene graph node to only
|
||||
-- be valid between January 1st, 2000 and March 1st, 2002.
|
||||
|
||||
local Node = {
|
||||
Identifier = "TimeFrameInterval_Example",
|
||||
TimeFrame = {
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "2000 JAN 01 00:00:00.000",
|
||||
End = "2002 MAR 02 00:00:00.00"
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "TimeFrameInterval - Basic",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -13,13 +13,13 @@ local Node = {
|
||||
{
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "2000 JAN 01 00:00:00.000",
|
||||
End = "2000 JAN 01 23:59:59.999"
|
||||
End = "2000 JAN 02 00:00:00.000"
|
||||
},
|
||||
-- The second TimeFrameInterval for the second day
|
||||
{
|
||||
Type = "TimeFrameInterval",
|
||||
Start = "2002 MAR 01 00:00:00.000",
|
||||
End = "2002 MAR 01 23:59:59.999"
|
||||
End = "2002 MAR 02 00:00:00.000"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
-- Basic
|
||||
-- This asset creates a SceneGraphNode that only displays coordinate axes. The coordinate
|
||||
-- axes are translated by a value determined by executing a Lua file that returns the
|
||||
-- translation parameters to be used as a table. In order to see the translation, we need
|
||||
-- to also have a node that does not move so that we can see the relative movement.
|
||||
-- This asset creates a scene graph node that only displays coordinate axes. The
|
||||
-- coordinate axes are translated by a value determined by executing a Lua file that
|
||||
-- returns the translation parameters to be used as a table. In order to see the
|
||||
-- translation, we need to also have a node that does not move so that we can see the
|
||||
-- relative movement.
|
||||
--
|
||||
-- ```{literalinclude} example.lua
|
||||
-- :language: lua
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Basic
|
||||
-- This asset creates a time-varying translation with information from a SPICE kernel and
|
||||
-- applies it to a SceneGraphNode that only displays coordinate axes. The position of the
|
||||
-- coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- applies it to a scene graph node that only displays coordinate axes. The position of
|
||||
-- the coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- orbiting the same way the Moon does around Earth.
|
||||
-- For more information about SPICE see: https://naif.jpl.nasa.gov/naif/
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
-- Fixed Date
|
||||
-- This asset creates a time-varying translation with information from a SPICE kernel and
|
||||
-- applies it to a SceneGraphNode that only displays coordinate axes. The position of the
|
||||
-- coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- applies it to a scene graph node that only displays coordinate axes. The position of
|
||||
-- the coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- orbiting the same way the Moon does around Earth. In this specific example, the
|
||||
-- position is independent of the actual in-game time in OpenSpace and only uses a fixed
|
||||
-- date of 2000 JAN 01 instead.
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
-- Reference Frame
|
||||
-- This asset creates a time-varying translation with information from a SPICE kernel and
|
||||
-- applies it to a SceneGraphNode that only displays coordinate axes. The position of the
|
||||
-- coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- applies it to a scene graph node that only displays coordinate axes. The position of
|
||||
-- the coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- orbiting the same way the Moon does around Earth. The calculated position will be
|
||||
-- provided in the rotating coordinate system of Earth itself.
|
||||
-- For more information about SPICE see: https://naif.jpl.nasa.gov/naif/
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Fixed Date
|
||||
-- This asset creates a time-varying translation with information from a SPICE kernel and
|
||||
-- applies it to a SceneGraphNode that only displays coordinate axes. The position of the
|
||||
-- coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- applies it to a scene graph node that only displays coordinate axes. The position of
|
||||
-- the coordinate axes are determined by SPICE, in this case pretending that the axes are
|
||||
-- orbiting the same way the Moon does around Earth. In this specific example, the position
|
||||
-- is offset 8h back compared to the actual in-game time in OpenSpace.
|
||||
-- For more information about SPICE see: https://naif.jpl.nasa.gov/naif/
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Basic
|
||||
-- This asset creates a scene graph node that only displays coordinate axes whose
|
||||
-- translation of the coordinate axes is determined by a timeline of individual
|
||||
-- translations. These translations are provided as keyframes that interpolate seamlessly
|
||||
-- between different positions.
|
||||
--
|
||||
-- This example will only work if the in-game time is set to January 1st, 2000.
|
||||
|
||||
local Node = {
|
||||
Identifier = "TimelineTranslation_Example",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "TimelineTranslation",
|
||||
Keyframes = {
|
||||
-- The first timeline entry
|
||||
["2000 JAN 01 00:00:00"] = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { -10.0, 0.0, 0.0 }
|
||||
},
|
||||
-- The second timeline entry
|
||||
["2000 JAN 01 12:00:00"] = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 0.0, 0.0, 0.0 }
|
||||
},
|
||||
-- The third timeline entry
|
||||
["2000 JAN 01 23:59:59"] = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 10.0, 0.0, 0.0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "TimelineTranslation - Basic",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -0,0 +1,55 @@
|
||||
-- No Interpolation
|
||||
-- This asset creates a scene graph node that only displays coordinate axes whose
|
||||
-- translation of the coordinate axes is determined by a timeline of individual
|
||||
-- translations that are used without interpolating between the timeline entries. These
|
||||
-- translations are keyframes that are used to change between different positions.
|
||||
--
|
||||
-- This example transitions between three positions. In this example, the interpolation
|
||||
-- between entries is disabled, which will cause the coordinate axes to change their
|
||||
-- position abruptly when the translation changes. If the interpolation were enabled, the
|
||||
-- orientation of the coordinate axes would transition seamlessly instead at the provided
|
||||
-- times.
|
||||
--
|
||||
-- This example will only work if the in-game time is set to January 1st, 2000.
|
||||
|
||||
local Node = {
|
||||
Identifier = "TimelineTranslation_Example_NoInterpolation",
|
||||
Transform = {
|
||||
Translation = {
|
||||
Type = "TimelineTranslation",
|
||||
Keyframes = {
|
||||
-- The first timeline entry
|
||||
["2000 JAN 01 00:00:00"] = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { -10.0, 0.0, 0.0 }
|
||||
},
|
||||
-- The second timeline entry
|
||||
["2000 JAN 01 12:00:00"] = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 0.0, 0.0, 0.0 }
|
||||
},
|
||||
-- The third timeline entry
|
||||
["2000 JAN 01 23:59:59"] = {
|
||||
Type = "StaticTranslation",
|
||||
Position = { 10.0, 0.0, 0.0 }
|
||||
}
|
||||
},
|
||||
ShouldInterpolate = false
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = "TimelineTranslation - No Interpolation",
|
||||
Path = "/Examples"
|
||||
}
|
||||
}
|
||||
|
||||
asset.onInitialize(function()
|
||||
openspace.addSceneGraphNode(Node)
|
||||
end)
|
||||
|
||||
asset.onDeinitialize(function()
|
||||
openspace.removeSceneGraphNode(Node)
|
||||
end)
|
||||
@@ -9,9 +9,9 @@ local DistanceJuiceJupiter = {
|
||||
Identifier = "JuiceJupiterDistance",
|
||||
Enabled = asset.enabled,
|
||||
SourceType = "Node",
|
||||
SourceNodeName = juice.Juice.Identifier,
|
||||
SourceNodeIdentifier = juice.Juice.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = jupiter.Jupiter.Identifier,
|
||||
DestinationNodeIdentifier = jupiter.Jupiter.Identifier,
|
||||
GuiName = "Juice - Jupiter Distance"
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ local DistanceJuiceGanymede = {
|
||||
Identifier = "JuiceGanymedeDistance",
|
||||
Enabled = asset.enabled,
|
||||
SourceType = "Node",
|
||||
SourceNodeName = juice.Juice.Identifier,
|
||||
SourceNodeIdentifier = juice.Juice.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = ganymede.Ganymede.Identifier,
|
||||
DestinationNodeIdentifier = ganymede.Ganymede.Identifier,
|
||||
GuiName = "Juice - Ganymede Distance"
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ local Distance = {
|
||||
Identifier = "MessengerDistance",
|
||||
GuiName = "Messenger - Mercury Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = messenger.Messenger.Identifier,
|
||||
SourceNodeIdentifier = messenger.Messenger.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = mercury.Mercury.Identifier
|
||||
DestinationNodeIdentifier = mercury.Mercury.Identifier
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ local Distance = {
|
||||
Identifier = "NewHorizonsPlutoDistance",
|
||||
GuiName = "New Horizons Pluto Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = "NewHorizons",
|
||||
SourceNodeIdentifier = "NewHorizons",
|
||||
DestinationType = "Node Surface",
|
||||
DestinationNodeName = "PlutoProjection"
|
||||
DestinationNodeIdentifier = "PlutoProjection"
|
||||
}
|
||||
|
||||
local Instruments = {
|
||||
|
||||
@@ -15,9 +15,9 @@ local Distance = {
|
||||
Identifier = "OsirisRexBennuDistance",
|
||||
GuiName = "OSIRIS-REx Bennu Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = model.OsirisRex.Identifier,
|
||||
SourceNodeIdentifier = model.OsirisRex.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = transforms.BennuBarycenter.Identifier
|
||||
DestinationNodeIdentifier = transforms.BennuBarycenter.Identifier
|
||||
}
|
||||
|
||||
local Instruments = {
|
||||
|
||||
@@ -15,9 +15,9 @@ local Distance = {
|
||||
Identifier = "Rosetta67PDistance",
|
||||
GuiName = "Rosetta 67P Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = rosetta.Rosetta.Identifier,
|
||||
SourceNodeIdentifier = rosetta.Rosetta.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = cg.Comet67P.Identifier
|
||||
DestinationNodeIdentifier = cg.Comet67P.Identifier
|
||||
}
|
||||
|
||||
local Instruments = {
|
||||
|
||||
@@ -8,9 +8,9 @@ local DistanceVoyager1 = {
|
||||
Identifier = "Voyager1Distance",
|
||||
GuiName = "Voyager 1 - Earth Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = voyager1.Voyager_1.Identifier,
|
||||
SourceNodeIdentifier = voyager1.Voyager_1.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = earth.Earth.Identifier,
|
||||
DestinationNodeIdentifier = earth.Earth.Identifier,
|
||||
Enabled = asset.enabled
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ local DistanceVoyager2 = {
|
||||
Identifier = "Voyager2Distance",
|
||||
GuiName = "Voyager 2 - Earth Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = voyager2.Voyager_2.Identifier,
|
||||
SourceNodeIdentifier = voyager2.Voyager_2.Identifier,
|
||||
DestinationType = "Node",
|
||||
DestinationNodeName = earth.Earth.Identifier,
|
||||
DestinationNodeIdentifier = earth.Earth.Identifier,
|
||||
Enabled = asset.enabled
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ local distance = {
|
||||
Identifier = "GaiaEarthDistance",
|
||||
GuiName = "Gaia Earth Distance",
|
||||
SourceType = "Node",
|
||||
SourceNodeName = gaia.Gaia.Identifier,
|
||||
SourceNodeIdentifier = gaia.Gaia.Identifier,
|
||||
DestinationType = "Node Surface",
|
||||
DestinationNodeName = earth.Earth.Identifier
|
||||
DestinationNodeIdentifier = earth.Earth.Identifier
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,16 +50,16 @@ namespace {
|
||||
"SourceType",
|
||||
"Source Type",
|
||||
"The type of position that is used as the triangle apex used to calculate the "
|
||||
"angle. The default value is 'Camera'.",
|
||||
"angle.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeNameInfo = {
|
||||
"SourceNodeName",
|
||||
"Source Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the apex of the triangle used to calculate the "
|
||||
"angle. The computed angle is the incident angle to Source in the triangle ("
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeIdentifierInfo = {
|
||||
"SourceNodeIdentifier",
|
||||
"Source Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the apex of the triangle used to calculate "
|
||||
"the angle. The computed angle is the incident angle to Source in the triangle ("
|
||||
"Source, Reference, Destination).",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
@@ -73,11 +73,12 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ReferenceNodeNameInfo = {
|
||||
"ReferenceNodeName",
|
||||
"Reference Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the reference direction to compute the angle.",
|
||||
constexpr openspace::properties::Property::PropertyInfo ReferenceNodeIdentifierInfo =
|
||||
{
|
||||
"ReferenceNodeIdentifier",
|
||||
"Reference Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the reference direction to compute the angle.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
@@ -86,21 +87,27 @@ namespace {
|
||||
"Destination Type",
|
||||
"The type of position that is used as the destination to calculate the angle. "
|
||||
"The computed angle is the incident angle to Source in the triangle ("
|
||||
"Source, Reference, Destination). The default value for this is 'Focus'.",
|
||||
"Source, Reference, Destination).",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DestinationNodeNameInfo = {
|
||||
"DestinationNodeName",
|
||||
"Destination Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the destination for computing the angle.",
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
DestinationNodeIdentifierInfo =
|
||||
{
|
||||
"DestinationNodeIdentifier",
|
||||
"Destination Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the destination for computing the angle.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This DashboardItem shows the angle between two scenegraph nodes relative to a
|
||||
// reference node. The angle is calculated in the plane that is defined by the
|
||||
// 'SourceNodeName', 'DestinationNodeName', and the 'ReferenceNodeName'.
|
||||
// This `DashboardItem` shows the angle between the lines `Source`->`Reference` and
|
||||
// `Source`->`Destination`. Each of `Source`, `Reference`, and `Destination` can be
|
||||
// either the identifier of a node, the current focus node, or the position of the
|
||||
// camera. The angle cannot be calculated if two of these three items are located in
|
||||
// the same position, in which case an error message is printed. The `SourceNodeName`,
|
||||
// `ReferenceNodeName`, and `DestinationNodeName` parameters are only used if the
|
||||
// `SourceType`, `ReferenceType`, or `DestinationType` respectively is set to `Node`.
|
||||
struct [[codegen::Dictionary(DashboardItemAngle)]] Parameters {
|
||||
enum class [[codegen::map(Type)]] Type {
|
||||
Node,
|
||||
@@ -109,17 +116,17 @@ namespace {
|
||||
};
|
||||
|
||||
// [[codegen::verbatim(SourceTypeInfo.description)]]
|
||||
std::optional<Type> sourceType;
|
||||
// [[codegen::verbatim(SourceNodeNameInfo.description)]]
|
||||
std::optional<std::string> sourceNodeName;
|
||||
Type sourceType;
|
||||
// [[codegen::verbatim(SourceNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> sourceNodeIdentifier;
|
||||
// [[codegen::verbatim(ReferenceTypeInfo.description)]]
|
||||
Type referenceType;
|
||||
// [[codegen::verbatim(ReferenceNodeNameInfo.description)]]
|
||||
std::optional<std::string> referenceNodeName;
|
||||
// [[codegen::verbatim(ReferenceNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> referenceNodeIdentifier;
|
||||
// [[codegen::verbatim(DestinationTypeInfo.description)]]
|
||||
std::optional<Type> destinationType;
|
||||
// [[codegen::verbatim(DestinationNodeNameInfo.description)]]
|
||||
std::optional<std::string> destinationNodeName;
|
||||
Type destinationType;
|
||||
// [[codegen::verbatim(DestinationNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> destinationNodeIdentifier;
|
||||
};
|
||||
#include "dashboarditemangle_codegen.cpp"
|
||||
} // namespace
|
||||
@@ -140,7 +147,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
SourceTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(SourceNodeNameInfo),
|
||||
properties::StringProperty(SourceNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
, _reference{
|
||||
@@ -148,7 +155,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
ReferenceTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(ReferenceNodeNameInfo),
|
||||
properties::StringProperty(ReferenceNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
, _destination{
|
||||
@@ -156,7 +163,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
DestinationTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(DestinationNodeNameInfo),
|
||||
properties::StringProperty(DestinationNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
{
|
||||
@@ -167,18 +174,13 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
{ Type::Focus, "Focus" },
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
if (p.sourceType.has_value()) {
|
||||
_source.type = codegen::map<Type>(*p.sourceType);
|
||||
}
|
||||
else {
|
||||
_source.type = Type::Camera;
|
||||
}
|
||||
_source.type = codegen::map<Type>(p.sourceType);
|
||||
addProperty(_source.type);
|
||||
|
||||
_source.nodeName.onChange([this]() { _source.node = nullptr; });
|
||||
_source.nodeIdentifier.onChange([this]() { _source.node = nullptr; });
|
||||
if (_source.type == Type::Node) {
|
||||
if (p.sourceNodeName.has_value()) {
|
||||
_source.nodeName = *p.sourceNodeName;
|
||||
if (p.sourceNodeIdentifier.has_value()) {
|
||||
_source.nodeIdentifier = *p.sourceNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -187,7 +189,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_source.nodeName);
|
||||
addProperty(_source.nodeIdentifier);
|
||||
|
||||
|
||||
_reference.type.addOptions({
|
||||
@@ -198,10 +200,10 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
_reference.type = codegen::map<Type>(p.referenceType);
|
||||
addProperty(_reference.type);
|
||||
|
||||
_reference.nodeName.onChange([this]() { _reference.node = nullptr; });
|
||||
_reference.nodeIdentifier.onChange([this]() { _reference.node = nullptr; });
|
||||
if (_reference.type == Type::Node) {
|
||||
if (p.referenceNodeName.has_value()) {
|
||||
_reference.nodeName = *p.referenceNodeName;
|
||||
if (p.referenceNodeIdentifier.has_value()) {
|
||||
_reference.nodeIdentifier = *p.referenceNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -210,24 +212,19 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_reference.nodeName);
|
||||
addProperty(_reference.nodeIdentifier);
|
||||
|
||||
_destination.type.addOptions({
|
||||
{ Type::Node, "Node" },
|
||||
{ Type::Focus, "Focus" },
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
if (p.destinationType.has_value()) {
|
||||
_destination.type = codegen::map<Type>(*p.destinationType);
|
||||
}
|
||||
else {
|
||||
_destination.type = Type::Focus;
|
||||
}
|
||||
_destination.type = codegen::map<Type>(p.destinationType);
|
||||
addProperty(_destination.type);
|
||||
_destination.nodeName.onChange([this]() { _destination.node = nullptr; });
|
||||
_destination.nodeIdentifier.onChange([this]() { _destination.node = nullptr; });
|
||||
if (_destination.type == Type::Node) {
|
||||
if (p.destinationNodeName.has_value()) {
|
||||
_destination.nodeName = *p.destinationNodeName;
|
||||
if (p.destinationNodeIdentifier.has_value()) {
|
||||
_destination.nodeIdentifier = *p.destinationNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -236,7 +233,7 @@ DashboardItemAngle::DashboardItemAngle(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_destination.nodeName);
|
||||
addProperty(_destination.nodeIdentifier);
|
||||
|
||||
_localBuffer.resize(128);
|
||||
}
|
||||
@@ -255,7 +252,8 @@ void DashboardItemAngle::update() {
|
||||
if (glm::length(a) == 0.0 || glm::length(b) == 0) {
|
||||
char* end = std::format_to(
|
||||
_localBuffer.data(),
|
||||
"Could not compute angle at {} between {} and {}",
|
||||
"Could not compute angle at {} between {} and {}. At least two of the three "
|
||||
"items are placed in the same location",
|
||||
sourceInfo.second, destinationInfo.second, referenceInfo.second
|
||||
);
|
||||
_buffer = std::string(_localBuffer.data(), end - _localBuffer.data());
|
||||
@@ -284,12 +282,13 @@ glm::vec2 DashboardItemAngle::size() const {
|
||||
std::pair<glm::dvec3, std::string> DashboardItemAngle::positionAndLabel(Component& comp) {
|
||||
if (comp.type == Type::Node) {
|
||||
if (!comp.node) {
|
||||
comp.node = global::renderEngine->scene()->sceneGraphNode(comp.nodeName);
|
||||
comp.node =
|
||||
global::renderEngine->scene()->sceneGraphNode(comp.nodeIdentifier);
|
||||
|
||||
if (!comp.node) {
|
||||
LERRORC(
|
||||
"DashboardItemAngle",
|
||||
"Could not find node '" + comp.nodeName.value() + "'"
|
||||
"Could not find node '" + comp.nodeIdentifier.value() + "'"
|
||||
);
|
||||
return { glm::dvec3(0.0), "Node" };
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
private:
|
||||
struct Component {
|
||||
properties::OptionProperty type;
|
||||
properties::StringProperty nodeName;
|
||||
properties::StringProperty nodeIdentifier;
|
||||
SceneGraphNode* node;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace {
|
||||
"FormatString",
|
||||
"Format String",
|
||||
"The format text describing how this dashboard item renders its text. This text "
|
||||
"must contain exactly one {} which is a placeholder that will contain the date.",
|
||||
"must contain exactly one {} which is a placeholder that will contain the date "
|
||||
"in the format as specified by `TimeFormat`.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
@@ -54,6 +55,10 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` shows the current in-game simulation time. The `FormatString`
|
||||
// and the `TimeFormat` options provide the ability to customize the output that is
|
||||
// printed. See these two parameters for more information on how to structure the
|
||||
// inputs.
|
||||
struct [[codegen::Dictionary(DashboardItemDate)]] Parameters {
|
||||
// [[codegen::verbatim(FormatStringInfo.description)]]
|
||||
std::optional<std::string> formatString;
|
||||
@@ -75,8 +80,8 @@ documentation::Documentation DashboardItemDate::Documentation() {
|
||||
|
||||
DashboardItemDate::DashboardItemDate(const ghoul::Dictionary& dictionary)
|
||||
: DashboardTextItem(dictionary, 15.f)
|
||||
, _formatString(FormatStringInfo, "Date: {} UTC")
|
||||
, _timeFormat(TimeFormatInfo, "YYYY MON DDTHR:MN:SC.### ::RND")
|
||||
, _formatString(FormatStringInfo, "Date: {}")
|
||||
, _timeFormat(TimeFormatInfo, "YYYY MON DD HR:MN:SC.### UTC ::RND")
|
||||
{
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
|
||||
@@ -51,32 +51,32 @@ namespace {
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceTypeInfo = {
|
||||
"SourceType",
|
||||
"Source Type",
|
||||
"The type of position that is used as the source to calculate the distance. The "
|
||||
"default value is 'Camera'.",
|
||||
"The type of position that is used as the source to calculate the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeNameInfo = {
|
||||
"SourceNodeName",
|
||||
"Source Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the source for computing the distance.",
|
||||
constexpr openspace::properties::Property::PropertyInfo SourceNodeIdentifierInfo = {
|
||||
"SourceNodeIdentifier",
|
||||
"Source Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the source for computing the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DestinationTypeInfo = {
|
||||
"DestinationType",
|
||||
"Destination Type",
|
||||
"The type of position that is used as the destination to calculate the distance. "
|
||||
"The default value for this is 'Focus'.",
|
||||
"The type of position that is used as the destination to calculate the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DestinationNodeNameInfo = {
|
||||
"DestinationNodeName",
|
||||
"Destination Node Name",
|
||||
"If a scene graph node is selected as type, this value specifies the name of the "
|
||||
"node that is to be used as the destination for computing the distance.",
|
||||
constexpr openspace::properties::Property::PropertyInfo
|
||||
DestinationNodeIdentifierInfo =
|
||||
{
|
||||
"DestinationNodeIdentifier",
|
||||
"Destination Node Identifier",
|
||||
"If a scene graph node is selected as type, this value specifies the identifier "
|
||||
"of the node that is to be used as the destination for computing the distance.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
@@ -106,6 +106,14 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
// This `DashboardItem` displays the distance between two points. The points can be
|
||||
// defined either by the location of a scene graph node, the surface of a scene graph
|
||||
// node's bounding sphere, the location of the current focus node, or the position of
|
||||
// the camera. These definitions can be mixed and matched to calculate any combination
|
||||
// of positions.
|
||||
//
|
||||
// The resulting text can be formatted in the `FormatString` and the measurement unit
|
||||
// is chosed by changing the `Simplification` and `RequestedUnit` parameters.
|
||||
struct [[codegen::Dictionary(DashboardItemDistance)]] Parameters {
|
||||
enum class [[codegen::map(Type)]] TypeInfo {
|
||||
Node,
|
||||
@@ -115,16 +123,16 @@ namespace {
|
||||
};
|
||||
|
||||
// [[codegen::verbatim(SourceTypeInfo.description)]]
|
||||
std::optional<TypeInfo> sourceType;
|
||||
TypeInfo sourceType;
|
||||
|
||||
// [[codegen::verbatim(SourceNodeNameInfo.description)]]
|
||||
std::optional<std::string> sourceNodeName;
|
||||
// [[codegen::verbatim(SourceNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> sourceNodeIdentifier;
|
||||
|
||||
// [[codegen::verbatim(DestinationTypeInfo.description)]]
|
||||
std::optional<TypeInfo> destinationType;
|
||||
TypeInfo destinationType;
|
||||
|
||||
// [[codegen::verbatim(DestinationNodeNameInfo.description)]]
|
||||
std::optional<std::string> destinationNodeName;
|
||||
// [[codegen::verbatim(DestinationNodeIdentifierInfo.description)]]
|
||||
std::optional<std::string> destinationNodeIdentifier;
|
||||
|
||||
// [[codegen::verbatim(SimplificationInfo.description)]]
|
||||
std::optional<bool> simplification;
|
||||
@@ -158,7 +166,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
SourceTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(SourceNodeNameInfo),
|
||||
properties::StringProperty(SourceNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
, _destination{
|
||||
@@ -166,7 +174,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
DestinationTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
),
|
||||
properties::StringProperty(DestinationNodeNameInfo),
|
||||
properties::StringProperty(DestinationNodeIdentifierInfo),
|
||||
nullptr
|
||||
}
|
||||
{
|
||||
@@ -179,24 +187,19 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
_source.type.onChange([this]() {
|
||||
_source.nodeName.setVisibility(
|
||||
_source.nodeIdentifier.setVisibility(
|
||||
properties::Property::Visibility(
|
||||
_source.type == Type::Node || _source.type == Type::NodeSurface
|
||||
)
|
||||
);
|
||||
});
|
||||
if (p.sourceType.has_value()) {
|
||||
_source.type = codegen::map<Type>(*p.sourceType);
|
||||
}
|
||||
else {
|
||||
_source.type = Type::Camera;
|
||||
}
|
||||
_source.type = codegen::map<Type>(p.sourceType);
|
||||
addProperty(_source.type);
|
||||
|
||||
_source.nodeName.onChange([this]() { _source.node = nullptr; });
|
||||
_source.nodeIdentifier.onChange([this]() { _source.node = nullptr; });
|
||||
if (_source.type == Type::Node || _source.type == Type::NodeSurface) {
|
||||
if (p.sourceNodeName.has_value()) {
|
||||
_source.nodeName = *p.sourceNodeName;
|
||||
if (p.sourceNodeIdentifier.has_value()) {
|
||||
_source.nodeIdentifier = *p.sourceNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -205,7 +208,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_source.nodeName);
|
||||
addProperty(_source.nodeIdentifier);
|
||||
|
||||
_destination.type.addOptions({
|
||||
{ Type::Node, "Node" },
|
||||
@@ -214,23 +217,18 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
{ Type::Camera, "Camera" }
|
||||
});
|
||||
_destination.type.onChange([this]() {
|
||||
_destination.nodeName.setVisibility(
|
||||
_destination.nodeIdentifier.setVisibility(
|
||||
properties::Property::Visibility(
|
||||
_source.type == Type::Node || _source.type == Type::NodeSurface
|
||||
)
|
||||
);
|
||||
});
|
||||
if (p.destinationType.has_value()) {
|
||||
_destination.type = codegen::map<Type>(*p.destinationType);
|
||||
}
|
||||
else {
|
||||
_destination.type = Type::Focus;
|
||||
}
|
||||
_destination.type = codegen::map<Type>(p.destinationType);
|
||||
addProperty(_destination.type);
|
||||
_destination.nodeName.onChange([this]() { _destination.node = nullptr; });
|
||||
_destination.nodeIdentifier.onChange([this]() { _destination.node = nullptr; });
|
||||
if (_destination.type == Type::Node || _destination.type == Type::NodeSurface) {
|
||||
if (p.destinationNodeName.has_value()) {
|
||||
_destination.nodeName = *p.destinationNodeName;
|
||||
if (p.destinationNodeIdentifier.has_value()) {
|
||||
_destination.nodeIdentifier = *p.destinationNodeIdentifier;
|
||||
}
|
||||
else {
|
||||
LERRORC(
|
||||
@@ -239,7 +237,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
addProperty(_destination.nodeName);
|
||||
addProperty(_destination.nodeIdentifier);
|
||||
|
||||
_doSimplification = p.simplification.value_or(_doSimplification);
|
||||
addProperty(_doSimplification);
|
||||
@@ -270,13 +268,13 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
|
||||
if ((mainComp.type == Type::Node) || (mainComp.type == Type::NodeSurface)) {
|
||||
if (!mainComp.node) [[unlikely]] {
|
||||
mainComp.node = global::renderEngine->scene()->sceneGraphNode(
|
||||
mainComp.nodeName
|
||||
mainComp.nodeIdentifier
|
||||
);
|
||||
|
||||
if (!mainComp.node) {
|
||||
LERRORC(
|
||||
"DashboardItemDistance",
|
||||
"Could not find node '" + mainComp.nodeName.value() + "'"
|
||||
"Could not find node '" + mainComp.nodeIdentifier.value() + "'"
|
||||
);
|
||||
return { glm::dvec3(0.0), "Node" };
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
private:
|
||||
struct Component {
|
||||
properties::OptionProperty type;
|
||||
properties::StringProperty nodeName;
|
||||
properties::StringProperty nodeIdentifier;
|
||||
SceneGraphNode* node;
|
||||
};
|
||||
|
||||
|
||||
@@ -70,12 +70,15 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` displays the remaining time until a provided `ReferenceTime`
|
||||
// or the elapsed time since the `ReferenceTime`. The output can be configured through
|
||||
// the `FormatString` and the unit that is used to display the configurable as well.
|
||||
struct [[codegen::Dictionary(DashboardItemElapsedTime)]] Parameters {
|
||||
// [[codegen::verbatim(FormatStringInfo.description)]]
|
||||
std::optional<std::string> formatString;
|
||||
|
||||
// [[codegen::verbatim(ReferenceTimeInfo.description)]]
|
||||
std::string referenceTime;
|
||||
std::string referenceTime [[codegen::datetime()]];
|
||||
|
||||
// [[codegen::verbatim(SimplifyTimeInfo.description)]]
|
||||
std::optional<bool> simplifyTime;
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
namespace {
|
||||
enum FrametimeType {
|
||||
DtTimeAvg = 0,
|
||||
DtTime = 0,
|
||||
DtTimeAvg,
|
||||
DtTimeExtremes,
|
||||
DtStandardDeviation,
|
||||
DtCoefficientOfVariation,
|
||||
@@ -60,6 +61,14 @@ namespace {
|
||||
};
|
||||
|
||||
[[nodiscard]] char* formatDt(std::vector<char>& buffer) {
|
||||
return std::format_to(
|
||||
buffer.data(),
|
||||
"Frametime: {:.2f} ms\0",
|
||||
openspace::global::windowDelegate->deltaTime()
|
||||
);
|
||||
}
|
||||
|
||||
[[nodiscard]] char* formatDtAvg(std::vector<char>& buffer) {
|
||||
return std::format_to(
|
||||
buffer.data(),
|
||||
"Avg. Frametime: {:.2f} ms\0",
|
||||
@@ -120,8 +129,10 @@ namespace {
|
||||
{
|
||||
using namespace openspace;
|
||||
switch (frametimeType) {
|
||||
case FrametimeType::DtTimeAvg:
|
||||
case FrametimeType::DtTime:
|
||||
return formatDt(buffer);
|
||||
case FrametimeType::DtTimeAvg:
|
||||
return formatDtAvg(buffer);
|
||||
case FrametimeType::DtTimeExtremes:
|
||||
return formatDtExtremes(buffer, minFrametimeCache, maxFrametimeCache);
|
||||
case FrametimeType::DtStandardDeviation:
|
||||
@@ -137,8 +148,29 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
// This `DashboardItem` provides information about the current framerate at which the
|
||||
// rendering updates. The `FrametimeType` can have different values that will show
|
||||
// different statistical aspects of the framerate.
|
||||
//
|
||||
// - `Deltatime`: Shows the time in milliseconds it took to render the previous
|
||||
// frame
|
||||
// - `Average Deltatime`: Shows the time that it took to render in milliseconds
|
||||
// averaged over the last 100 or so frames
|
||||
// - `Deltatime extremes`: Shows the minimum and maximum values of the render time
|
||||
// in milliseconds over the last 100 or so frames
|
||||
// - `Deltatime standard deviation`: Shows the standard deviation of the render time
|
||||
// in milliseconds over the last 100 or so frames
|
||||
// - `Deltatime coefficient of variation`: Shows the normalized root-mean-square
|
||||
// deviation of the render time in
|
||||
// milliseconds over the last 100 or so
|
||||
// frames
|
||||
// - `Frames per second`: Shows the inverse of the delta time it took the render the
|
||||
// last frame.
|
||||
// - `Average frames per second`: Shows average number of frames that have been
|
||||
// presented over the last 100 or so frames
|
||||
struct [[codegen::Dictionary(DashboardItemFramerate)]] Parameters {
|
||||
enum class [[codegen::map(FrametimeType)]] Type {
|
||||
DtTime [[codegen::key("Deltatime")]],
|
||||
DtTimeAvg [[codegen::key("Average Deltatime")]],
|
||||
DtTimeExtremes [[codegen::key("Deltatime extremes")]],
|
||||
DtStandardDeviation [[codegen::key("Deltatime standard deviation")]],
|
||||
@@ -152,7 +184,6 @@ namespace {
|
||||
std::optional<Type> frametimeType;
|
||||
};
|
||||
#include "dashboarditemframerate_codegen.cpp"
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -172,6 +203,7 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
|
||||
const Parameters p = codegen::bake<Parameters>(dictionary);
|
||||
|
||||
_frametimeType.addOptions({
|
||||
{ static_cast<int>(FrametimeType::DtTime), "Deltatime" },
|
||||
{ static_cast<int>(FrametimeType::DtTimeAvg), "Average Deltatime" },
|
||||
{ static_cast<int>(FrametimeType::DtTimeExtremes), "Deltatime extremes" },
|
||||
{
|
||||
|
||||
@@ -69,7 +69,12 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
struct [[codegen::Dictionary(DashboardItemPropertyValue)]] Parameters {
|
||||
// This `DashboardItem` shows the current state of the different methods to provide
|
||||
// user input: keyboard, mouse, and/or joystick.
|
||||
//
|
||||
// Each input method has the ability to be selectively disabled, meaning that all
|
||||
// inputs from that input method are ignored by the system entirely.
|
||||
struct [[codegen::Dictionary(DashboardItemInputState)]] Parameters {
|
||||
// [[codegen::verbatim(ShowWhenEnabledInfo.description)]]
|
||||
std::optional<bool> showWhenEnabled;
|
||||
|
||||
@@ -166,9 +171,7 @@ void DashboardItemInputState::update() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!text.empty()) {
|
||||
_buffer = ghoul::join(std::move(text), "\n");
|
||||
}
|
||||
_buffer = ghoul::join(std::move(text), "\n");
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemInputState::size() const {
|
||||
|
||||
@@ -51,15 +51,21 @@ namespace {
|
||||
progress.append("|");
|
||||
return progress;
|
||||
}
|
||||
|
||||
// This `DashboardItem` shows information about the currently active mission. This
|
||||
// includes information about the currently active mission phase, the next phase, and
|
||||
// all subphases of the currently active phase.
|
||||
struct [[codegen::Dictionary(DashboardItemMission)]] Parameters {};
|
||||
#include "dashboarditemmission_codegen.cpp"
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation DashboardItemMission::Documentation() {
|
||||
documentation::Documentation doc = DashboardTextItem::Documentation();
|
||||
doc.name = "DashboardItemMission";
|
||||
doc.id = "base_dashboarditem_mission";
|
||||
return doc;
|
||||
return codegen::doc<Parameters>(
|
||||
"base_dashboarditem_mission",
|
||||
DashboardTextItem::Documentation()
|
||||
);
|
||||
}
|
||||
|
||||
DashboardItemMission::DashboardItemMission(const ghoul::Dictionary& dictionary)
|
||||
|
||||
@@ -34,13 +34,26 @@
|
||||
#include <ghoul/font/font.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
|
||||
namespace {
|
||||
// This `DashboardItem` displays information about the status of the parallel
|
||||
// connection, which is whether OpenSpace is directly connected to other OpenSpace
|
||||
// instances and can either control those instances or be controlled by the master of
|
||||
// the session. If OpenSpace is not connected, this `DashboardItem` will not display
|
||||
// anything.
|
||||
//
|
||||
// The information presented contains how many clients are connected to the same
|
||||
// session and whether this machine is currently the host of the session.
|
||||
struct [[codegen::Dictionary(DashboardItemParallelConnection)]] Parameters {};
|
||||
#include "dashboarditemparallelconnection_codegen.cpp"
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation DashboardItemParallelConnection::Documentation() {
|
||||
documentation::Documentation doc = DashboardTextItem::Documentation();
|
||||
doc.name = "DashboardItemParallelConnection";
|
||||
doc.id = "base_dashboarditem_parallelconnection";
|
||||
return doc;
|
||||
return codegen::doc<Parameters>(
|
||||
"base_dashboarditem_parallelconnection",
|
||||
DashboardTextItem::Documentation()
|
||||
);
|
||||
}
|
||||
|
||||
DashboardItemParallelConnection::DashboardItemParallelConnection(
|
||||
|
||||
@@ -67,11 +67,16 @@ namespace {
|
||||
"the value itself will be displayed), or it must contain extact one or more "
|
||||
"instances of {}, which will be replaced with the value(s) of the property "
|
||||
"during rendering. For scalar types, there has to be exactly one instance of {}, "
|
||||
"for vector types, there need to be as many {} as there are compoents in the "
|
||||
"vector, for example two {} for vec2 types, three for vec3 types, etc.",
|
||||
"for vector types, there need to be as many {} as there are components in the "
|
||||
"vector, for example two {} for vec2 types, three for vec3 types, etc. For more "
|
||||
"information on how to structure the formatting string, see the documentation at "
|
||||
"https://en.cppreference.com/w/cpp/utility/format/spec.",
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` will show the value of the provided property. Depending on the
|
||||
// type of the property, the `DisplayString` will have to be adapted. See the
|
||||
// documentation for the `DisplayString` for more information.
|
||||
struct [[codegen::Dictionary(DashboardItemPropertyValue)]] Parameters {
|
||||
// [[codegen::verbatim(PropertyUriInfo.description)]]
|
||||
std::optional<std::string> uri [[codegen::key("URI")]];
|
||||
|
||||
@@ -61,7 +61,9 @@ namespace {
|
||||
"delta time. This format gets five parameters in this order: The target delta "
|
||||
"time value, the target delta time unit, the string 'Paused' if the delta time "
|
||||
"is paused or the empty string otherwise, the current delta time value, and the "
|
||||
"current delta time unit.",
|
||||
"current delta time unit. More information about how to make use of the format "
|
||||
"string, see the documentation at "
|
||||
"https://en.cppreference.com/w/cpp/utility/format/spec.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
@@ -71,7 +73,9 @@ namespace {
|
||||
"The format string used to format the text if the target delta time is the same "
|
||||
"as the current delta time. This format gets three parameters in this order: "
|
||||
"The target delta value, the target delta unit, and the string 'Paused' if the "
|
||||
"delta time is paused or the empty string otherwise.",
|
||||
"delta time is paused or the empty string otherwise. More information about how "
|
||||
"to make use of the format string, see the documentation at "
|
||||
"https://en.cppreference.com/w/cpp/utility/format/spec.",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
@@ -88,6 +92,10 @@ namespace {
|
||||
return res;
|
||||
}
|
||||
|
||||
// This `DashboardItem` shows how fast the in-game time progresses. The display string
|
||||
// for the `RegularFormat` is used when the current simulation increment is not
|
||||
// changing, the `TransitionFormat` is used if the simulation increment is currently
|
||||
// interpolating to a new value.
|
||||
struct [[codegen::Dictionary(DashboardItemSimulationIncrement)]] Parameters {
|
||||
// [[codegen::verbatim(SimplificationInfo.description)]]
|
||||
std::optional<bool> simplification;
|
||||
@@ -143,6 +151,7 @@ DashboardItemSimulationIncrement::DashboardItemSimulationIncrement(
|
||||
if (p.requestedUnit.has_value()) {
|
||||
const TimeUnit unit = timeUnitFromString(*p.requestedUnit);
|
||||
_requestedUnit = static_cast<int>(unit);
|
||||
_doSimplification = false;
|
||||
}
|
||||
_requestedUnit.setVisibility(properties::Property::Visibility::Hidden);
|
||||
addProperty(_requestedUnit);
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
// This `DashboardItem` adds a variable amount of spacing between two other
|
||||
// `DashboardItem`s.
|
||||
struct [[codegen::Dictionary(DashboardItemSpacing)]] Parameters {
|
||||
// [[codegen::verbatim(SpacingInfo.description)]]
|
||||
std::optional<float> spacing;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user