local transforms = asset.require("./titan")



local Atmosphere = {
  Identifier = "TitanAtmosphere",
  Parent = transforms.Titan.Identifier,
  Renderable = {
    Type = "RenderableAtmosphere",
    -- Atmosphere radius in Km
    AtmosphereHeight = 2666.0 - 2576.0,
    PlanetRadius = 2576.0,
    PlanetAverageGroundReflectance = 0.1,
    GroundRadianceEmission = 0.9,
    SunIntensity = 6.9,
    Rayleigh = {
      Coefficients = {
        -- Wavelengths are given in 10^-9m
        Wavelengths = { 680, 550, 440 },
        -- Reflection coefficients are given in km^-1
        Scattering = { 0.005349578367831898, 0.01265595939366191, 0.03133178295339324 }
      },
      -- Thickness of atmosphere if its density were uniform, in Km
      H_R = 20.0
    },
    Mie = {
        Coefficients = {
          -- Reflection coefficients are given in km^-1
          Scattering = { 0.005, 0.012, 0.08 },
          -- Extinction coefficients are a fraction of the Mie coefficients
          Extinction = { 0.004 / 0.37, 0.004 / 0.37, 0.004 / 0.37 }
        },
        -- Height scale (atmosphere thickness for constant density) in km
        H_M = 14.85,
        -- Mie Phase Function Value
        -- (G e [-1.0, 1.0]. If G = 1.0, Mie phase function = Rayleigh Phase Function)
        G = -0.52
    },
    Debug = {
        PreCalculatedTextureScale = 1.0,
        SaveCalculatedTextures = false
    }
  },
  GUI = {
    Name = "Titan Atmosphere",
    Path = "/Solar System/Planets/Saturn/Major Moons/Titan"
  }
}


asset.onInitialize(function()
  openspace.addSceneGraphNode(Atmosphere)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(Atmosphere)
end)

asset.export(Atmosphere)



asset.meta = {
  Name = "Titan Atmosphere",
  Version = "1.1",
  Description = "RenderableAtmosphere for Titan",
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
