SceneGraphLightSource

Inherits LightSource

Members

Name

Documentation

Type

Description

Optional

Node

The identifier of the scene graph node to follow.

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Intensity

The intensity of this light source.

Double

Value of type ‘Double’

Yes

Inherited members from LightSource

Name

Documentation

Type

Description

Optional

Identifier

The identifier of the light source

Identifier

An identifier string. May not contain ‘.’, spaces, newlines, or tabs

No

Type

The type of the light source that is described in this element. The available types of light sources depend on the configuration of the application and can be written to disk on application startup into the FactoryDocumentation

String

Must name a valid LightSource type

No

Enabled

Whether the light source is enabled or not.

Boolean

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}