Files
OpenSpace/data/assets/examples/discs.asset
Alexander Bock 8b74493d96 Removing the asset_helper file (#1868)
- Remove the asset_helper file and call the onInitialize and onDeinitialize functions directly
 - Small compile fix on Windows
 - Removes the need for the registerIdentifierWithMeta function by automatically doing that for all asset.export statements
 - Allow the passing of either identifiers (as before) or entire tables to the removeSceneGraphNode, removeScreenSpaceRenderable, deleteLayer, removeAction, and export methods. In that case, the Identifier key from the table is extracted and used instead
2022-02-01 23:44:36 +01:00

54 lines
1.3 KiB
Lua

-- @TODO (emmbr 2020-02-03) Potential threading issue later on? This will run on the main thread
local cyanTexture = openspace.createSingleColorImage("example_disc_color1", { 0.0, 1.0, 1.0 })
local purpleTexture = openspace.createSingleColorImage("example_disc_color2", { 0.5, 0.0, 0.5 })
local BasicDisc = {
Identifier = "BasicDisc",
Renderable = {
Type = "RenderableDisc",
Texture = cyanTexture,
Size = 1e10,
Width = 0.5
},
GUI = {
Name = "Basic Disc",
Path = "/Examples/Discs"
}
}
-- Elliptic discs can be created using a non-uniform scaling
-- For a full disc, use a width of 1.0
local FullEllipticDisc = {
Identifier = "FullEllipticDisc",
Transform = {
Scale = {
Type = "NonUniformStaticScale",
Scale = { 2.0, 1.0, 1.0 }
}
},
Renderable = {
Type = "RenderableDisc",
Texture = purpleTexture,
Size = 2e10,
Width = 1.0
},
GUI = {
Name = "Full Elliptic Disc",
Path = "/Examples/Discs"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(BasicDisc)
openspace.addSceneGraphNode(FullEllipticDisc)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(FullEllipticDisc)
openspace.removeSceneGraphNode(BasicDisc)
end)
asset.export(BasicDisc)
asset.export(FullEllipticDisc)