DashboardItemDistance

Inherits DashboardItem

Members

Name

Documentation

Type

Description

Optional

DestinationNodeName

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

String

Value of type ‘String’

Yes

DestinationType

The type of position that is used as the destination to calculate the distance. The default value for this is ‘Focus’

String

In list { Node, Node Surface, Focus, Camera }

Yes

FontName

This value is the name of the font that is used. It can either refer to an internal name registered previously, or it can refer to a path that is used

String

Value of type ‘String’

Yes

FontSize

This value determines the size of the font that is used to render the distance

Double

Value of type ‘Double’

Yes

FormatString

The format string that is used for formatting the distance string. This format receives four parameters: The name of the source, the name of the destination the value of the distance and the unit of the distance

String

Value of type ‘String’

Yes

RequestedUnit

If the simplification is disabled, this distance unit is used as a destination to convert the meters into

String

In list { nanometer, micrometer, millimeter, centimeter, decimeter, meter, km, AU, lighthour, lightday, lightmonth, lightyear, parsec, kiloparsec, megaparsec, gigaparsec, gigalightyear, thou, inch, foot, yard, chain, furlong, mile, league }

Yes

Simplification

If this value is enabled, the distance is displayed in nuanced units, such as km, AU, light years, parsecs, etc. If this value is disabled, the unit can be explicitly requested

Boolean

Value of type ‘Boolean’

Yes

SourceNodeName

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

String

Value of type ‘String’

Yes

SourceType

The type of position that is used as the source to calculate the distance. The default value is ‘Camera’

String

In list { Node, Node Surface, Focus, Camera }

Yes

Asset Examples

  1local Angle = {
  2  Type = "DashboardItemAngle",
  3  Identifier = "Angle",
  4  ReferenceType = "Node",
  5  ReferenceNodeName = "Earth",
  6  DestinationType = "Node",
  7  DestinationNodeName = "Moon"
  8}
  9
 10local Date = {
 11  Type = "DashboardItemDate",
 12  Identifier = "Date"
 13}
 14
 15local SimulationIncrement = {
 16  Type = "DashboardItemSimulationIncrement",
 17  Identifier = "SimulationIncrement",
 18  GuiName = "Simulation Increment"
 19}
 20
 21local Distance = {
 22  Type = "DashboardItemDistance",
 23  Identifier = "Distance"
 24}
 25
 26local Framerate = {
 27  Type = "DashboardItemFramerate",
 28  Identifier = "Framerate"
 29}
 30
 31local ParallelConnection = {
 32  Type = "DashboardItemParallelConnection",
 33  Identifier = "ParallelConnection",
 34  GuiName = "Parallel Connection"
 35}
 36
 37local Mission = {
 38  Type = "DashboardItemMission",
 39  Identifier = "Mission"
 40}
 41
 42local PropertyValue = {
 43  Type = "DashboardItemPropertyValue",
 44  Identifier = "DashbaordItemPropertyValue",
 45  URI = "Scene.Earth.Renderable.Enabled",
 46  DisplayString = "Earth is enabled: {}"
 47}
 48
 49local PropertyValueFloat = {
 50  Type = "DashboardItemPropertyValue",
 51  Identifier = "DashbaordItemPropertyValue_Float",
 52  URI = "Scene.Earth.Renderable.TargetLodScaleFactor",
 53  DisplayString = "Earth LOD is {:.5f}"
 54}
 55
 56local PropertyValueDouble = {
 57  Type = "DashboardItemPropertyValue",
 58  Identifier = "DashbaordItemPropertyValue_Double",
 59  URI = "NavigationHandler.PathNavigator.ArrivalDistanceFactor",
 60  DisplayString = "Arrival Distance Factor is {:.8f}"
 61}
 62
 63local PropertyValueInt = {
 64  Type = "DashboardItemPropertyValue",
 65  Identifier = "DashbaordItemPropertyValue_Int",
 66  URI = "LuaConsole.HistoryLength",
 67  DisplayString = "History length is {}"
 68}
 69
 70local PropertyValueUInt = {
 71  Type = "DashboardItemPropertyValue",
 72  Identifier = "DashboardItemPropertyValue_UInt",
 73  URI = "Modules.Globebrowsing.TileCacheSize",
 74  DisplayString = "Tile Cache Size is {}"
 75}
 76
 77local PropertyValueDVec3 = {
 78  Type = "DashboardItemPropertyValue",
 79  Identifier = "DashboardItemPropertyValue_DVec3",
 80  URI = "Scene.SolarSystemBarycenter.Transform.Transform",
 81  DisplayString = "SSB Transform is: ({}, {}, {})"
 82}
 83
 84local PropertyValueIVec2 = {
 85  Type = "DashboardItemPropertyValue",
 86  Identifier = "DashboardItemPropertyValue_IVec2",
 87  URI = "Scene.SolarSystemBarycenter.Renderable.ScreenSpacePosition",
 88  DisplayString = "Random ScreenSpace Position: ({}, {})"
 89}
 90
 91local PropertyValueVec2 = {
 92  Type = "DashboardItemPropertyValue",
 93  Identifier = "DashboardItemPropertyValue_Vec2",
 94  URI = "Scene.EarthAtmosphere.Renderable.AtmosphereDimmingSunsetAngle",
 95  DisplayString = "Sunset Angle is ({}, {})"
 96}
 97
 98local PropertyValueVec3 = {
 99  Type = "DashboardItemPropertyValue",
100  Identifier = "DashboardItemPropertyValue_Vec3",
101  URI = "RenderEngine.GlobalRotation",
102  DisplayString = "Global Rotation is ({}, {}, {})"
103}
104
105local PropertyValueVec4 = {
106  Type = "DashboardItemPropertyValue",
107  Identifier = "DashboardItemPropertyValue_Vec4",
108  URI = "LuaConsole.BackgroundColor",
109  DisplayString = "Background Coolor is ({}, {}, {}, {})"
110}
111
112local ElapsedTime = {
113  Type = "DashboardItemElapsedTime",
114  Identifier = "ElapsedTime",
115  ReferenceTime = "2022-10-12 12:00:00"
116}
117
118local InputState = {
119  Type = "DashboardItemInputState",
120  Identifier = "InputState"
121}
122
123
124asset.onInitialize(function()
125  openspace.dashboard.addDashboardItem(Angle)
126  openspace.dashboard.addDashboardItem(Date)
127  openspace.dashboard.addDashboardItem(SimulationIncrement)
128  openspace.dashboard.addDashboardItem(Distance)
129  openspace.dashboard.addDashboardItem(Framerate)
130  openspace.dashboard.addDashboardItem(ParallelConnection)
131  openspace.dashboard.addDashboardItem(Mission)
132  openspace.dashboard.addDashboardItem(PropertyValue)
133  openspace.dashboard.addDashboardItem(PropertyValueFloat)
134  openspace.dashboard.addDashboardItem(PropertyValueDouble)
135  openspace.dashboard.addDashboardItem(PropertyValueInt)
136  openspace.dashboard.addDashboardItem(PropertyValueUInt)
137  openspace.dashboard.addDashboardItem(PropertyValueDVec3)
138  openspace.dashboard.addDashboardItem(PropertyValueIVec2)
139  openspace.dashboard.addDashboardItem(PropertyValueVec2)
140  openspace.dashboard.addDashboardItem(PropertyValueVec3)
141  openspace.dashboard.addDashboardItem(PropertyValueVec4)
142  openspace.dashboard.addDashboardItem(ElapsedTime)
143  openspace.dashboard.addDashboardItem(InputState)
144end)
145
146asset.onDeinitialize(function()
147  openspace.dashboard.removeDashboardItem(InputState)
148  openspace.dashboard.removeDashboardItem(ElapsedTime)
149  openspace.dashboard.removeDashboardItem(PropertyValueVec4)
150  openspace.dashboard.removeDashboardItem(PropertyValueVec3)
151  openspace.dashboard.removeDashboardItem(PropertyValueVec2)
152  openspace.dashboard.removeDashboardItem(PropertyValueIVec2)
153  openspace.dashboard.removeDashboardItem(PropertyValueDVec3)
154  openspace.dashboard.removeDashboardItem(PropertyValueUInt)
155  openspace.dashboard.removeDashboardItem(PropertyValueInt)
156  openspace.dashboard.removeDashboardItem(PropertyValueDouble)
157  openspace.dashboard.removeDashboardItem(PropertyValueFloat)
158  openspace.dashboard.removeDashboardItem(PropertyValue)
159  openspace.dashboard.removeDashboardItem(Mission)
160  openspace.dashboard.removeDashboardItem(ParallelConnection)
161  openspace.dashboard.removeDashboardItem(Framerate)
162  openspace.dashboard.removeDashboardItem(Distance)
163  openspace.dashboard.removeDashboardItem(SimulationIncrement)
164  openspace.dashboard.removeDashboardItem(Date)
165  openspace.dashboard.removeDashboardItem(Angle)
166end)
167
168asset.export(Angle)
169asset.export(Date)
170asset.export(SimulationIncrement)
171asset.export(Distance)
172asset.export(Framerate)
173asset.export(ParallelConnection)
174asset.export(Mission)
175asset.export(PropertyValue)
176asset.export(PropertyValueFloat)
177asset.export(PropertyValueDouble)
178asset.export(PropertyValueInt)
179asset.export(PropertyValueUInt)
180asset.export(PropertyValueDVec3)
181asset.export(PropertyValueIVec2)
182asset.export(PropertyValueVec2)
183asset.export(PropertyValueVec3)
184asset.export(PropertyValueVec4)
185asset.export(ElapsedTime)
186asset.export(InputState)
187
188
189asset.meta = {
190  Name = "Dashboard Items Example",
191  Version = "1.0",
192  Description = [[Examples of different types of dashboard items. These are dynamic
193    information texts that will be shown over the rendering (per default in the top
194    left corner, on flat screens).]],
195  Author = "OpenSpace Team",
196  URL = "http://openspaceproject.com",
197  License = "MIT license"
198}