-- This asset requires OpenSpace to be built with the OPENSPACE_MODULE_VOLUME enabled

-- Before using this asset,
-- the volume data itself needs to be generated,
-- using the task 'data/tasks/volume/debristasks/generate_debris_volume.task'

local transforms = asset.require("scene/solarsystem/planets/earth/transforms")

local maxApogee = 10946320;

local volume = {
  Identifier = "DebrisVolume - Spherical",
  Parent = transforms.EarthInertial.Identifier,
  Renderable = {
    Type = "RenderableTimeVaryingVolume",
    SourceDirectory = asset.localResource("generated"),
    TransferFunction = asset.localResource("transferfunction.txt"),
    StepSize = 0.01,
    MinValue = 0,
    MaxValue = 1,
    GridType = "Spherical",
    SecondsBefore = 50*365*24*60*60,
    SecondsAfter = 50*365*24*60*60
  },
  GUI = {
    Path = "/Volumes"
  },
  Transform = {
    Scale = {
      Type = "StaticScale",   
      Scale = maxApogee    --do not multiply this. That will not show real representation.
    }
  }
}

asset.onInitialize(function()
  openspace.addSceneGraphNode(volume)
end)
  
asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(volume)
end)
  
asset.export(volume)



asset.meta = {
  Name = "Satellites Debris - Volume Spherical",
  Version = "1.0",
  Description = "Satellites asset for Debris - Volume Spherical. Example asset",
  Author = "OpenSpace Team",
  URL = "",
  License = "MIT"
}
