local transforms = asset.require("../transforms")
asset.require("spice/base")
asset.require("./trail")
local kernel = asset.require("../kernels").jup310

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

local Io = {
  Identifier = "Io",
  Parent = transforms.JupiterBarycenter.Identifier,
  Transform = {
    Rotation = {
      Type = "SpiceRotation",
      SourceFrame = "IAU_IO",
      DestinationFrame = "GALACTIC",
      Kernels = kernel
    },
    Translation = {
      Type = "SpiceTranslation",
      Target = "IO",
      Observer = "JUPITER BARYCENTER",
      Kernels = kernel
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = 1821600,
    SegmentsPerPatch = 64,
    Layers = {},
    Labels = {
      Enabled = false,
      FileName = labelsPath .. "io.labels",
      AlignmentOption = "Horizontally", -- or Circularly
      FontSize = 20.0,
      Size = 11.0,
      FadeInEnabled = true,
      FadeOutEnabled = true,
      FadeDistances = { 4000000.0, 8500000.0 },
      DistanceEPS = 1000000.0,
      Color = { 1.0, 1.0, 0.0 }
    }
  },
  Tag = { "moon_solarSystem", "moon_giants", "moon_jupiter" },
  GUI = {
    Path = "/Solar System/Planets/Jupiter/Moons"
  }
}

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



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