Files
OpenSpace/data/assets/examples/volume/generated/spherical.asset
T
2022-11-22 21:06:52 +01:00

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_spherical.task'
local transforms = asset.require("scene/solarsystem/sun/transforms")
local astronomicalUnit = 149597870700
local volume = {
Identifier = "GeneratedVolume",
Parent = transforms.SolarSystemBarycenter.Identifier,
Transform = {
Scale = {
Type = "StaticScale",
Scale = astronomicalUnit
}
},
Renderable = {
Type = "RenderableTimeVaryingVolume",
SourceDirectory = asset.localResource("spherical"),
TransferFunction = asset.localResource("../transferfunction.txt"),
StepSize = 0.01,
MinValue = 0,
MaxValue = 1,
GridType = "Spherical",
SecondsBefore = 50*365*24*60*60, -- 50 years before
SecondsAfter = 50*365*24*60*60 -- 50 years after
},
GUI = {
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(volume)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(volume)
end)
asset.export(volume)