mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-31 08:29:04 -06:00
- 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
45 lines
1.1 KiB
Lua
45 lines
1.1 KiB
Lua
-- This asset requires OpenSpace to be built with the OPENSPACE_MODULE_VOLUME enabled
|
|
|
|
-- Before using this example,
|
|
-- the volume data itself needs to be generated,
|
|
-- using the task 'data/tasks/volume/generate_cartesian_sequence.task'
|
|
|
|
local transforms = asset.require("scene/solarsystem/sun/transforms")
|
|
|
|
local sunRadius = 695508000
|
|
|
|
local volume = {
|
|
Identifier = "GeneratedVolume",
|
|
Parent = transforms.SolarSystemBarycenter.Identifier,
|
|
Renderable = {
|
|
Type = "RenderableTimeVaryingVolume",
|
|
SourceDirectory = asset.localResource("cartesiansequence"),
|
|
TransferFunction = asset.localResource("../transferfunction.txt"),
|
|
StepSize = 0.01,
|
|
MinValue = 0,
|
|
MaxValue = 1,
|
|
GridType = "Cartesian",
|
|
SecondsBefore = 50*365*24*60*60, -- 50 years before
|
|
SecondsAfter = 50*365*24*60*60 -- 50 years after
|
|
},
|
|
GUI = {
|
|
Path = "/Examples"
|
|
},
|
|
Transform = {
|
|
Scale = {
|
|
Type = "StaticScale",
|
|
Scale = 1000 * sunRadius
|
|
}
|
|
}
|
|
}
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(volume)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(volume)
|
|
end)
|
|
|
|
asset.export(volume)
|