RenderablePrism
Inherits Renderable
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The number of segments the shape of the prism should have |
|
Value of type ‘Integer’ |
No |
|
The radius of the base of the prism’s shape, in meters. By default it is given the same radius as the outer shape |
|
Value of type ‘Double’ |
Yes |
|
This value determines the RGB color for the line |
|
Value of type ‘Color3’ |
Yes |
|
The length of the prism in meters |
|
Value of type ‘Double’ |
Yes |
|
The number of lines connecting the two shapes of the prism. They will be evenly distributed around the bounding circle that makes up the shape of the prism |
|
Value of type ‘Integer’ |
Yes |
|
This value specifies the line width |
|
Value of type ‘Double’ |
Yes |
|
The radius of the prism’s shape in meters |
|
Value of type ‘Double’ |
Yes |
Inherited members from Renderable
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
Enables/Disables if the object should be dimmed when the camera is in the sunny part of an atmosphere |
|
Value of type ‘Boolean’ |
Yes |
|
This setting 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 |
|
This value specifies if the renderable should be rendered in the Background,Opaque, Pre/PostDeferredTransparency, or Overlay rendering step |
|
In list { Background, Opaque, PreDeferredTransparent, PostDeferredTransparent, Overlay } |
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 |
|
This tells the type of the renderable |
|
Value of type ‘String’ |
Yes |
Asset Examples
1asset.require("./actions")
2asset.require("./mission")
3local sunTransforms = asset.require("scene/solarsystem/sun/transforms")
4local transforms = asset.require("./transforms")
5
6
7
8local models = asset.resource({
9 Name = "JWST Model",
10 Type = "HttpSynchronization",
11 Identifier = "jwst_model",
12 Version = 3
13})
14
15local band = asset.resource({
16 Name = "JWST band texture",
17 Type = "HttpSynchronization",
18 Identifier = "jwst_band_texture",
19 Version = 1
20})
21
22
23local LaunchTime = "2021 DEC 25 12:20:00"
24
25local JWSTBand = {
26 Identifier = "JWSTBand",
27 Parent = transforms.JWSTPosition.Identifier,
28 TimeFrame = {
29 Type = "TimeFrameInterval",
30 Start = LaunchTime
31 },
32 Transform = {
33 Rotation = {
34 Type = "FixedRotation",
35 Attached = "JWSTBand",
36 XAxis = { 1.0, 0.0, 0.0 },
37 XAxisOrthogonal = true,
38 ZAxis = sunTransforms.SolarSystemBarycenter.Identifier
39 }
40 },
41 Renderable = {
42 Type = "RenderableSphereImageLocal",
43 Texture = band .. "JWST-band.png",
44 Size = 9.2E15,
45 Segments = 50,
46 DisableFadeInOut = true,
47 Orientation = "Inside",
48 Opacity = 0.05
49 },
50 Tag = { "mission_jwst_fov" },
51 GUI = {
52 Name = "JWST Safe Viewing Band",
53 Path = "/Solar System/Telescopes/JWST",
54 Description = [[
55 The safe viewing band for the James Webb Space Telescope at its current position
56 ]]
57 }
58}
59
60local JWSTModel = {
61 Identifier = "JWSTModel",
62 Parent = transforms.JWSTRotation.Identifier,
63 TimeFrame = {
64 Type = "TimeFrameInterval",
65 Start = LaunchTime
66 },
67 Renderable = {
68 Type = "RenderableModel",
69 GeometryFile = models .. "jwst_anim74_2fps_2018_nb.osmodel",
70 ModelScale = 0.0328, -- First scale down with centimeters then scale up with feet
71 EnableAnimation = true,
72 AnimationStartTime = "2021 12 25 12:20:00",
73 AnimationTimeScale = "Millisecond",
74 AnimationMode = "Once",
75 LightSources = {
76 sunTransforms.LightSource
77 },
78 PerformShading = true
79 },
80 GUI = {
81 Name = "James Webb Space Telescope Model",
82 Path = "/Solar System/Telescopes/JWST",
83 Description = [[
84 Animated model of the James Webb Space Telescope that shows its deployment in
85 real time
86 ]]
87 }
88}
89
90local JWSTFov = {
91 Identifier = "JWSTFov",
92 Parent = JWSTModel.Identifier,
93 TimeFrame = {
94 Type = "TimeFrameInterval",
95 Start = LaunchTime
96 },
97 Renderable = {
98 Type = "RenderablePrism",
99 Segments = 6,
100 Lines = 3,
101 Radius = 3.25,
102 LineWidth = 1.0,
103 Color = { 1.0, 1.0, 1.0 },
104 Length = 9.2E15
105 },
106 Transform = {
107 Rotation = {
108 Type = "StaticRotation",
109 Rotation = { 0, 0, math.rad(30) }
110 }
111 },
112 Tag = { "mission_jwst_fov" },
113 GUI = {
114 Name = "JWST Field of View",
115 Path = "/Solar System/Telescopes/JWST",
116 Description = [[
117 The field of view for the James Webb Space Telescope at its current position
118 ]]
119 }
120}
121
122local JWSTLabel = {
123 Identifier = "JWSTLabel",
124 Parent = transforms.JWSTPosition.Identifier,
125 TimeFrame = {
126 Type = "TimeFrameInterval",
127 Start = LaunchTime
128 },
129 Renderable = {
130 Type = "RenderableLabel",
131 Text = "JWST",
132 FontSize = 50,
133 Size = 6.5,
134 MinMaxSize = { 4.0, 30.0 },
135 OrientationOption = "Camera View Direction",
136 BlendMode = "Normal",
137 EnableFading = false
138 },
139 GUI = {
140 Name = "JWST Label",
141 Path = "/Solar System/Telescopes/JWST",
142 Description = "Main label for the James Webb Space Telescope"
143 }
144}
145
146
147asset.onInitialize(function()
148 openspace.addSceneGraphNode(JWSTBand)
149 openspace.addSceneGraphNode(JWSTModel)
150 openspace.addSceneGraphNode(JWSTFov)
151 openspace.addSceneGraphNode(JWSTLabel)
152end)
153
154asset.onDeinitialize(function()
155 openspace.removeSceneGraphNode(JWSTLabel)
156 openspace.removeSceneGraphNode(JWSTFov)
157 openspace.removeSceneGraphNode(JWSTModel)
158 openspace.removeSceneGraphNode(JWSTBand)
159
160 openspace.scriptScheduler.clear(2)
161end)
162
163asset.export(JWSTBand)
164asset.export(JWSTModel)
165asset.export(JWSTFov)
166asset.export(JWSTLabel)
167
168
169
170asset.meta = {
171 Name = "James Webb Space Telescope",
172 Version = "1.1",
173 Description = [[
174 James Webb Space Telescope animated model, safe viewing band, field of view and label.
175 ]],
176 Author = "OpenSpace Team",
177 URL = "http://openspaceproject.com",
178 License = "MIT license"
179}