SceneGraphLightSource
Inherits LightSource
This LightSource
type represents a light source placed at the position of a scene graph node. That is, the direction of the light will follow the position of an existing object in the scene. It will also update dynamically as the object moves.
Note that the brightness of the light from the light source does not depend on the distance between the two scene graph nodes. Only the Intensity
value has an impact on the brightness.
Members
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The identifier of the scene graph node to follow. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
The intensity of this light source. |
|
Value of type ‘Double’ |
Yes |
Inherited members from LightSource
Name |
Documentation |
Type |
Description |
Optional |
---|---|---|---|---|
|
The identifier of the light source. |
|
An identifier string. May not contain ‘.’, spaces, newlines, or tabs |
No |
|
The type of light source that is described in this element. |
|
Must name a valid |
No |
|
Whether the light source is enabled or not. |
|
Value of type ‘Boolean’ |
Yes |
Asset Examples
1local sunTransforms = asset.require("scene/solarsystem/sun/transforms")
2local transforms = asset.require("./transforms")
3
4
5
6local model = asset.resource({
7 Name = "JUICE Model",
8 Type = "HttpSynchronization",
9 Identifier = "juice_models",
10 Version = 1
11})
12
13
14local JuiceModel = {
15 Identifier = "JuiceModel",
16 Parent = transforms.Juice.Identifier,
17 Transform = {
18 Translation = {
19 Type = "StaticTranslation",
20 -- Offset numbers found by eyeballing
21 Position = { 4.5, 0.0, -1.0 }
22 },
23 Rotation = {
24 Type = "StaticRotation",
25 Rotation = { math.pi / 2.0, 0.0, 0.0 }
26 }
27 },
28 Renderable = {
29 Type = "RenderableModel",
30 GeometryFile = model .. "juice.fbx",
31 ModelScale = "Centimeter",
32 LightSources = {
33 {
34 Type = "SceneGraphLightSource",
35 Identifier = "Sun",
36 Node = sunTransforms.SolarSystemBarycenter.Identifier,
37 Intensity = 0.6
38 },
39 {
40 Identifier = "Camera",
41 Type = "CameraLightSource",
42 Intensity = 0.4,
43 Enabled = false
44 }
45 }
46 },
47 GUI = {
48 Name = "Juice Model",
49 Path = "/Solar System/Missions/Juice",
50 Description = "The model of the JUICE spacecraft"
51 }
52}
53
54
55asset.onInitialize(function()
56 openspace.addSceneGraphNode(JuiceModel)
57end)
58
59asset.onDeinitialize(function()
60 openspace.removeSceneGraphNode(JuiceModel)
61end)
62
63asset.export(JuiceModel)
64
65
66
67asset.meta = {
68 Name = "Juice Model",
69 Description = [[
70 The model of the JUICE spacecraft. The model file was taken from
71 https://www.cosmos.esa.int/web/esac-cmso/scifleet.
72 ]],
73 Author = "OpenSpace Team",
74 URL = "http://openspaceproject.com",
75 License = "MIT license"
76}