RenderableDistanceLabel

Inherits Renderable

Creates a label that shows the distance between two nodes, based on an existing RenderableNodeLine. The label will be placed halfway between the two scene graph nodes that the line connects.

The unit in which the distance is displayed can be customized, as well as the precision of the number.

Members

Name

Documentation

Type

Description

Optional

NodeLine

The identifier of a scene graph node with a RenderableNodeLine that this label should track. The label text will be updating based on the distance from the node line’s start and end.

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

BlendMode

This determines the blending mode that is applied to the renderable.

String

In list { Normal, Additive }

Yes

Color

The label text color.

Color3

Value of type ‘Color3’

Yes

CustomUnitDescriptor

Property to define a custom unit descriptor to use to describe the distance value. Defaults to the selected unit’s SI descriptor if not specified.

String

Value of type ‘String’

Yes

DimInAtmosphere

Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere.

Boolean

Value of type ‘Boolean’

Yes

DistanceUnit

The unit in which the distance value should be displayed. Defaults to ‘km’ if not specified.

String

In list { Nanometer, Micrometer, Millimeter, Centimeter, Decimeter, Meter, Kilometer, AU, Lighthour, Lightday, Lightmonth, Lightyear, Parsec, Kiloparsec, Megaparsec, Gigaparsec, Gigalightyear, Thou, Inch, Foot, Yard, Chain, Furlong, Mile, League, Nautical Mile }

Yes

Enabled

Determines whether this object will be visible or not.

Boolean

Value of type ‘Boolean’

Yes

EnableFading

Enable/Disable the Fade-in effect.

Boolean

Value of type ‘Boolean’

Yes

FadeDistances

The distance range in which the labels should be fully opaque, specified in the chosen unit. The distance from the position of the label to the camera.

Vector2<double>

Greater or equal to: {0,0}

Yes

FadeUnit

Distance unit for fade-in/-out distance calculations. Defaults to “au”.

String

In list { m, Km, Mm, Gm, Tm, Pm, au, pc, Kpc, Mpc, Gpc, Gly }

Yes

FadeWidths

The distances over which the fading takes place, given in the specified unit. The first value is the distance before the closest distance and the second the one after the furthest distance. For example, with the unit Parsec (pc), a value of {1, 2} will make the label being fully faded out 1 Parsec before the closest distance and 2 Parsec away from the furthest distance.

Vector2<double>

Greater or equal to: {0,0}

Yes

FontSize

The font size (in points) for the label.

Double

Greater than: 0

Yes

MinMaxSize

The minimum and maximum size (in pixels) of the label.

Vector2<int>

Value of type ‘Vector2

Yes

Opacity

This value determines the opacity of this renderable. A value of 0 means completely transparent.

Double

In range: ( 0, 1)

Yes

OrientationOption

Label orientation rendering mode.

String

In list { Camera View Direction, Camera Position Normal }

Yes

Precision

The precision in which to to show the distance number, i.e. the number of digits after the decimal point.

Integer

Greater or equal to: 0

Yes

RenderBinMode

A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step.

String

In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker }

Yes

Size

Scales the size of the label, exponentially. The value is used as the exponent in a 10^x computation to scale the label size.

Double

Greater or equal to: 0

Yes

Tag

A single tag or a list of tags that this renderable will respond to when setting properties.

Table, or String

Value of type ‘Table’, or Value of type ‘String’

Yes

Text

The text that will be displayed on screen.

String

Value of type ‘String’

Yes

TransformationMatrix

Transformation matrix to be applied to the label.

Matrix4x4<double>

Value of type ‘Matrix4x4

Yes

Type

The type of the renderable.

String

Value of type ‘String’

Yes

Inherited members from Renderable

Name

Documentation

Type

Description

Optional

DimInAtmosphere

Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere.

Boolean

Value of type ‘Boolean’

Yes

Enabled

Determines whether this object will be visible or not.

Boolean

Value of type ‘Boolean’

Yes

Opacity

This value determines the opacity of this renderable. A value of 0 means completely transparent.

Double

In range: ( 0, 1)

Yes

RenderBinMode

A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step.

String

In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker }

Yes

Tag

A single tag or a list of tags that this renderable will respond to when setting properties.

Table, or String

Value of type ‘Table’, or Value of type ‘String’

Yes

Type

The type of the renderable.

String

Value of type ‘String’

Yes

Asset Examples

Custom Unit Descriptor

In addition to setting the unit, it is also possible to specify a custom unit descriptor, i.e. a text that will de displayed for the unit instead of the default one. Here, we write out “Astronomical Units” instead of using the default descriptor for AU.

 1local nodelineAsset = asset.require("examples/renderable/renderablenodeline/nodeline")
 2
 3local Node = {
 4  Identifier = "RenderableDistanceLabel_Example_CustomDescriptor",
 5  Renderable = {
 6    Type = "RenderableDistanceLabel",
 7    NodeLine = nodelineAsset.NodeLine.Identifier,
 8    DistanceUnit = "AU",
 9    Precision = 2,
10    CustomUnitDescriptor = "Astronomical Units"
11  },
12  GUI = {
13    Name = "RenderableDistanceLabel - Custom Unit Descriptor",
14    Path = "/Examples"
15  }
16}
17
18
19asset.onInitialize(function()
20  openspace.addSceneGraphNode(Node)
21end)
22
23asset.onDeinitialize(function()
24  openspace.removeSceneGraphNode(Node)
25end)
Basic

This example adds a distance label between two nodes in the scene, based on an existing RenderableNodeLine. Note that the identifier of the RenderableNodeLine is accessed by importing another example asset, which also adds the node line to the scene.

 1local nodelineAsset = asset.require("examples/renderable/renderablenodeline/nodeline")
 2
 3local Node = {
 4  Identifier = "RenderableDistanceLabel_Example",
 5  Renderable = {
 6    Type = "RenderableDistanceLabel",
 7    NodeLine = nodelineAsset.NodeLine.Identifier
 8  },
 9  GUI = {
10    Name = "RenderableDistanceLabel - Basic",
11    Path = "/Examples"
12  }
13}
14
15
16asset.onInitialize(function()
17  openspace.addSceneGraphNode(Node)
18end)
19
20asset.onDeinitialize(function()
21  openspace.removeSceneGraphNode(Node)
22end)
Set Unit

Per default, the distance is displayed in meters. This example shows how to specify a specific unit, and how to set the precision of dislayed number.

 1local nodelineAsset = asset.require("examples/renderable/renderablenodeline/nodeline")
 2
 3local Node = {
 4  Identifier = "RenderableDistanceLabel_Example_Unit",
 5  Renderable = {
 6    Type = "RenderableDistanceLabel",
 7    NodeLine = nodelineAsset.NodeLine.Identifier,
 8    DistanceUnit = "AU",
 9    Precision = 2
10  },
11  GUI = {
12    Name = "RenderableDistanceLabel - Unit",
13    Path = "/Examples"
14  }
15}
16
17
18asset.onInitialize(function()
19  openspace.addSceneGraphNode(Node)
20end)
21
22asset.onDeinitialize(function()
23  openspace.removeSceneGraphNode(Node)
24end)