RenderableGrid

Inherits Renderable

This Renderable can be used to create a planar grid, to for example illustrate distances in 3D space.

The grid is created by specifying a size and how many segments to split each dimension into. A secondary color can be used to highlight grid lines with a given interval.

Members

Name

Documentation

Type

Description

Optional

Color

The color of the grid lines.

Color3

Value of type ‘Color3’

Yes

HighlightColor

The color of the highlighted lines in the grid.

Color3

Value of type ‘Color3’

Yes

HighlightLineWidth

The width of the highlighted grid lines. The larger number, the thicker the lines.

Double

Value of type ‘Double’

Yes

HighlightRate

The rate that the columns and rows are highlighted, counted with respect to the center of the grid. If the number of segments in the grid is odd, the highlighting might be offset from the center.

Vector2<int>

Value of type ‘Vector2

Yes

Labels

The labels for the grid.

Table

LabelsComponent

Yes

LineWidth

The width of the grid lines. The larger number, the thicker the lines.

Double

Value of type ‘Double’

Yes

Segments

The number of segments to split the grid into, in each direction (x and y).

Vector2<int>

Value of type ‘Vector2

Yes

Size

The size of the grid (in the x and y direction), given in meters.

Vector2<double>

Value of type ‘Vector2

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

Basic

This example adds a planar grid of 100x100 meters to the scene. Per default, the grid consist of 10x10 segments.

 1local Node = {
 2  Identifier = "RenderableGrid_Example",
 3  Renderable = {
 4    Type = "RenderableGrid",
 5    Size = { 100.0, 100.0 }
 6  },
 7  GUI = {
 8    Name = "RenderableGrid - Basic",
 9    Path = "/Examples"
10  }
11}
12
13asset.onInitialize(function()
14  openspace.addSceneGraphNode(Node)
15end)
16
17asset.onDeinitialize(function()
18  openspace.removeSceneGraphNode(Node)
19end)
Specifying Segments

This example adds a planar grid of 50x100 meters, split into 5 segments in the x-direction and 10 segments in the y-direction so that each segment is 10x10 meters.

 1local Node = {
 2  Identifier = "RenderableGrid_Example_Segments",
 3  Renderable = {
 4    Type = "RenderableGrid",
 5    Size = { 50.0, 100.0 },
 6    Segments = { 5, 10 }
 7  },
 8  GUI = {
 9    Name = "RenderableGrid - Segments",
10    Path = "/Examples"
11  }
12}
13
14asset.onInitialize(function()
15  openspace.addSceneGraphNode(Node)
16end)
17
18asset.onDeinitialize(function()
19  openspace.removeSceneGraphNode(Node)
20end)
Higlighting Grid Lines

This example adds a planar grid of 100x100 meters, with highlight color for every 5th grid line in each direction.

 1local Node = {
 2  Identifier = "RenderableGrid_Example_Highlights",
 3  Renderable = {
 4    Type = "RenderableGrid",
 5    Size = { 100.0, 100.0 },
 6    HighlightColor = { 0.0, 1.0, 0.0 },
 7    HighlightRate = { 5, 5 },
 8    HighlightLineWidth = 2.0
 9  },
10  GUI = {
11    Name = "RenderableGrid - Highlights",
12    Path = "/Examples"
13  }
14}
15
16asset.onInitialize(function()
17  openspace.addSceneGraphNode(Node)
18end)
19
20asset.onDeinitialize(function()
21  openspace.removeSceneGraphNode(Node)
22end)
Styled

This example adds a planar grid of 100x100 meters, with a custom color and line width.

 1local Node = {
 2  Identifier = "RenderableGrid_Example_Styled",
 3  Renderable = {
 4    Type = "RenderableGrid",
 5    Size = { 100.0, 100.0 },
 6    Color = { 0.0, 1.0, 0.0 },
 7    LineWidth = 2.0
 8  },
 9  GUI = {
10    Name = "RenderableGrid - Styled",
11    Path = "/Examples"
12  }
13}
14
15asset.onInitialize(function()
16  openspace.addSceneGraphNode(Node)
17end)
18
19asset.onDeinitialize(function()
20  openspace.removeSceneGraphNode(Node)
21end)