RenderableDisc
Inherits Renderable
This renderable can be used to create a circular disc that is colored based on a one-dimensional texture.
The disc will be filled i.e. a full circle, per default, but may also be made with a hole in the center using the Width
parameter.
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The path to a file with a one-dimensional texture to be used for the disc color. The leftmost color will be innermost color when rendering the disc, and the rightmost color will be the outermost color. |
|
Value of type ‘File’ |
No |
|
The outer radius of the disc, in meters. |
|
Value of type ‘Double’ |
Yes |
|
The disc width, given as a ratio of the full disc radius. For example, a value of 1 results in a full circle, while 0.5 results in a disc where the inner radius is half of the full radius. |
|
In range: ( 0,1 ) |
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
Ellipse
This example creates a disc with an ellipic shape, using a non-uniform scaling.
This renderable requires a texture to be loaded, even for just a single color. Use the utility function that exists for creating single color textures for this purpose.
1local purpleTexture = openspace.createSingleColorImage(
2 "example_disc_color_purple",
3 { 0.5, 0.0, 0.5 }
4)
5
6local Node = {
7 Identifier = "RenderableDisc_Example_Ellipse",
8 Transform = {
9 -- Elliptic discs can be created using a non-uniform scaling
10 Scale = {
11 Type = "NonUniformStaticScale",
12 Scale = { 2.0, 1.0, 1.0 }
13 }
14 },
15 Renderable = {
16 Type = "RenderableDisc",
17 Size = 100.0,
18 Texture = purpleTexture
19 },
20 GUI = {
21 Name = "RenderableDisc - Ellipse",
22 Path = "/Examples"
23 }
24}
25
26asset.onInitialize(function()
27 openspace.addSceneGraphNode(Node)
28end)
29
30asset.onDeinitialize(function()
31 openspace.removeSceneGraphNode(Node)
32end)
With Hole
This example creates a disc that has a hole in it. By specifying a Width
of 0.5, the
disc will stop halfway from the edge to the center point. The disc is rendered with a
single color and an outer radius of 100 meters.
This renderable requires a texture to be loaded, even for just a single color. Use the utility function that exists for creating single color textures for this purpose.
1local cyanTexture = openspace.createSingleColorImage(
2 "example_disc_color_cyan",
3 { 0.0, 1.0, 1.0 }
4)
5
6local Node = {
7 Identifier = "RenderableDisc_Example_WithHole",
8 Renderable = {
9 Type = "RenderableDisc",
10 Size = 100.0,
11 Width = 0.5,
12 Texture = cyanTexture
13 },
14 GUI = {
15 Name = "RenderableDisc - With Hole",
16 Path = "/Examples"
17 }
18}
19
20asset.onInitialize(function()
21 openspace.addSceneGraphNode(Node)
22end)
23
24asset.onDeinitialize(function()
25 openspace.removeSceneGraphNode(Node)
26end)
Basic
This example creates a disc with a single color and a radius of 100 meters.
This renderable requires a texture to be loaded, even for just a single color. Use the utility function that exists for creating single color textures for this purpose.
1local cyanTexture = openspace.createSingleColorImage(
2 "example_disc_color_cyan",
3 { 0.0, 1.0, 1.0 }
4)
5
6local Node = {
7 Identifier = "RenderableDisc_Example",
8 Renderable = {
9 Type = "RenderableDisc",
10 Size = 100.0,
11 Texture = cyanTexture
12 },
13 GUI = {
14 Name = "RenderableDisc - Basic",
15 Path = "/Examples"
16 }
17}
18
19asset.onInitialize(function()
20 openspace.addSceneGraphNode(Node)
21end)
22
23asset.onDeinitialize(function()
24 openspace.removeSceneGraphNode(Node)
25end)