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 Hyperion = {
  Identifier = "Hyperion",
  Parent = transforms.SaturnBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "HYPERION",
      Observer = "SATURN BARYCENTER",
      Kernels = kernel
    }
    --[[
      The IAU report does not give an orientation model for Hyperion.
      Hyperion's rotation is in chaotic and is not predictable for
      long periods.
    ]]--
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 360200, 266000, 205400},
    SegmentsPerPatch = 64,
    Layers = {},
    Labels = {
      -- @TODO (2021-05-21, emmbr26) These labels do not seem to be visible
      Enabled = false,
      FileName = labelsPath .. "hyperion.labels",
      AlignmentOption = "Horizontally", -- or Circularly
      FontSize = 20.0,
      Size = 8.6,
      FadeInEnabled = true,
      FadeDistances = { 500000.0, 1000000.0 },
      DistanceEPS = 1350000.0,
      Color = { 1.0, 1.0, 0.0 }
    }
  },
  Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" },
  GUI = {
    Name = "Hyperion",
    Path = "/Solar System/Planets/Saturn/Moons"
  }
}

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



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