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 |
|---|---|---|---|---|
|
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. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
This determines the blending mode that is applied to the renderable. |
|
In list { Normal, Additive } |
Yes |
|
The label text color. |
|
Value of type ‘Color3’ |
Yes |
|
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. |
|
Value of type ‘String’ |
Yes |
|
Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere. |
|
Value of type ‘Boolean’ |
Yes |
|
The unit in which the distance value should be displayed. Defaults to ‘km’ if not specified. |
|
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 |
|
Determines whether this object will be visible or not. |
|
Value of type ‘Boolean’ |
Yes |
|
Enable/Disable the Fade-in effect. |
|
Value of type ‘Boolean’ |
Yes |
|
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. |
|
Greater or equal to: {0,0} |
Yes |
|
Distance unit for fade-in/-out distance calculations. Defaults to “au”. |
|
In list { m, Km, Mm, Gm, Tm, Pm, au, pc, Kpc, Mpc, Gpc, Gly } |
Yes |
|
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. |
|
Greater or equal to: {0,0} |
Yes |
|
The font size (in points) for the label. |
|
Greater than: 0 |
Yes |
|
The minimum and maximum size (in pixels) of the label. |
|
Value of type ‘Vector2 |
Yes |
|
This value determines the opacity of this renderable. A value of 0 means completely transparent. |
|
In range: ( 0, 1) |
Yes |
|
Label orientation rendering mode. |
|
In list { Camera View Direction, Camera Position Normal } |
Yes |
|
The precision in which to to show the distance number, i.e. the number of digits after the decimal point. |
|
Greater or equal to: 0 |
Yes |
|
A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step. |
|
In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker } |
Yes |
|
Scales the size of the label, exponentially. The value is used as the exponent in a 10^x computation to scale the label size. |
|
Greater or equal to: 0 |
Yes |
|
A single tag or a list of tags that this renderable will respond to when setting properties. |
|
Value of type ‘Table’, or Value of type ‘String’ |
Yes |
|
The text that will be displayed on screen. |
|
Value of type ‘String’ |
Yes |
|
Transformation matrix to be applied to the label. |
|
Value of type ‘Matrix4x4 |
Yes |
|
The type of the renderable. |
|
Value of type ‘String’ |
Yes |
Inherited members from Renderable
Name |
Documentation |
Type |
Description |
Optional |
|---|---|---|---|---|
|
Decides if the object should be dimmed (i.e. faded out) when the camera is in the sunny part of an atmosphere. |
|
Value of type ‘Boolean’ |
Yes |
|
Determines whether this object will be visible or not. |
|
Value of type ‘Boolean’ |
Yes |
|
This value determines the opacity of this renderable. A value of 0 means completely transparent. |
|
In range: ( 0, 1) |
Yes |
|
A value that specifies if the renderable should be rendered in the Background, Opaque, Pre-/PostDeferredTransparency, Overlay, or Sticker rendering step. |
|
In list { Background, Opaque, PreDeferredTransparent, Overlay, PostDeferredTransparent, Sticker } |
Yes |
|
A single tag or a list of tags that this renderable will respond to when setting properties. |
|
Value of type ‘Table’, or Value of type ‘String’ |
Yes |
|
The type of the renderable. |
|
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)