local transforms = asset.require("../transforms")
local kernel = asset.require("../kernels").sat375
asset.require("./trail")

local labelsPath = asset.syncedResource({
  Name = "Saturn Labels",
  Type = "HttpSynchronization",
  Identifier = "saturn_labels",
  Version = 1
})

local Titan = {
  Identifier = "Titan",
  Parent = transforms.SaturnBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "TITAN",
      Observer = "SATURN BARYCENTER",
      Kernels = kernel
    },
    Rotation = {
      Type = "SpiceRotation",
      SourceFrame = "IAU_TITAN",
      DestinationFrame = "GALACTIC"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = 2576000,
    SegmentsPerPatch = 64,
    Layers = {},
    Labels = {
      Enabled = false,
      FileName = labelsPath .. "titan.labels",
      AlignmentOption = "Horizontally", -- or Circularly
      FontSize = 20.0,
      Size = 9.6,
      FadeInEnabled = true,
      FadeOutEnabled = true,
      FadeDistances = { 5000000.0, 7500000.0 },
      DistanceEPS = 1350000.0,
      Color = { 1.0, 1.0, 0.0 }
    }
  },
  Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" },
  GUI = {
    Name = "Titan",
    Path = "/Solar System/Planets/Saturn/Moons/Titan",
    Description = "Largest moon of Saturn"
  }
}

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



asset.meta = {
  Name = "Titan",
  Version = "1.2",
  Description = "Titan globe with labels",
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
