RenderableGrid

Inherits Renderable

Members

Name

Documentation

Type

Description

Optional

Color

This value determines the color of the grid lines that are rendered

Color3

Value of type ‘Color3’

Yes

HighlightColor

This value determines the color of the highlighted lines in the grid

Color3

Value of type ‘Color3’

Yes

HighlightLineWidth

This value specifies the line width of the highlighted lines in the grid

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

This value specifies the line width of the grid

Double

Value of type ‘Double’

Yes

Segments

This value specifies the number of segments that are used to render the grid in each direction

Vector2<int>

Value of type ‘Vector2

Yes

Size

This value species the size of each dimensions of the grid

Vector2<double>

Value of type ‘Vector2

Yes

Inherited members from Renderable

Name

Documentation

Type

Description

Optional

DimInAtmosphere

Enables/Disables if the object should be dimmed when the camera is in the sunny part of an atmosphere

Boolean

Value of type ‘Boolean’

Yes

Enabled

This setting 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

This value specifies if the renderable should be rendered in the Background,Opaque, Pre/PostDeferredTransparency, or Overlay rendering step

String

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

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

This tells the type of the renderable

String

Value of type ‘String’

Yes

Asset Examples

  1local AU = 149597870700 -- 1 AU
  2
  3local RadialGrid = {
  4  Identifier = "ExampleRadialGrid",
  5  Parent = "Root",
  6  Transform = {
  7    Scale = {
  8      Type = "StaticScale",
  9      Scale = AU
 10    }
 11  },
 12  Renderable = {
 13    Type = "RenderableRadialGrid",
 14    Opacity = 0.8,
 15    Color = { 0.6, 1.0, 0.7 },
 16    LineWidth = 3.0,
 17    GridSegments = { 3, 4 },
 18    Radii = { 0.2, 1.0 }
 19  },
 20  GUI = {
 21    Name = "Example Radial Grid",
 22    Description = [[A circular 2D grid, with segments based on the radius and angle.]],
 23    Path = "/Examples/Grids"
 24  }
 25}
 26
 27local PlanarGrid = {
 28  Identifier = "ExampleGrid",
 29  Transform = {
 30    Scale = {
 31      Type = "StaticScale",
 32      Scale = AU
 33    }
 34  },
 35  Renderable = {
 36    Type = "RenderableGrid",
 37    Color = { 0.0, 1.0, 0.8 },
 38    LineWidth = 2.0,
 39    Segments = { 6, 10 },
 40    Size = { 1, 2 },
 41    HighlightColor = { 1.0, 0.8, 0.0 },
 42    HighlightLineWidth = 3.2,
 43    HighlightRate = { 3, 3 }
 44  },
 45  GUI = {
 46    Name = "Example Grid",
 47    Description = [[A basic 2D grid, with a given size and number of segments.]],
 48    Path = "/Examples/Grids"
 49  }
 50}
 51
 52local SphericalGrid = {
 53  Identifier = "ExampleSphericalGrid",
 54  Transform = {
 55    Scale = {
 56      Type = "StaticScale",
 57      Scale = AU
 58    }
 59  },
 60  Renderable = {
 61    Type = "RenderableSphericalGrid",
 62    Color = { 1.0, 0.5, 0.2 },
 63    LineWidth = 2.0,
 64    Segments = 40
 65  },
 66  GUI = {
 67    Name = "Example Spherical Grid",
 68    Description = [[A grid in the form of a 3D sphere.]],
 69    Path = "/Examples/Grids"
 70  }
 71}
 72
 73local BoxGrid = {
 74  Identifier = "ExampleBoxGrid",
 75  Transform = {
 76    Scale = {
 77      Type = "StaticScale",
 78      Scale = AU
 79    }
 80  },
 81  Renderable = {
 82    Type = "RenderableBoxGrid",
 83    Enabled = false,
 84    Color = { 0.5, 0.0, 1.0 },
 85    LineWidth = 2.0,
 86    Size = { 2, 2, 2 },
 87  },
 88  GUI = {
 89    Name = "Example Box Grid",
 90    Description = [[A grid in the form of a 3D box.]],
 91    Path = "/Examples/Grids"
 92  }
 93}
 94
 95
 96asset.onInitialize(function()
 97  openspace.addSceneGraphNode(RadialGrid)
 98  openspace.addSceneGraphNode(PlanarGrid)
 99  openspace.addSceneGraphNode(SphericalGrid)
100  openspace.addSceneGraphNode(BoxGrid)
101end)
102
103asset.onDeinitialize(function()
104  openspace.removeSceneGraphNode(BoxGrid)
105  openspace.removeSceneGraphNode(SphericalGrid)
106  openspace.removeSceneGraphNode(PlanarGrid)
107  openspace.removeSceneGraphNode(RadialGrid)
108end)
109
110asset.export(RadialGrid)
111asset.export(PlanarGrid)
112asset.export(SphericalGrid)
113asset.export(BoxGrid)
114
115
116asset.meta = {
117  Name = "Example Grids",
118  Version = "1.0",
119  Description = [[Examples of different types of rendered grids.]],
120  Author = "OpenSpace Team",
121  URL = "http://openspaceproject.com",
122  License = "MIT license"
123}