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



local Carpo = {
  Identifier = "Carpo",
  Parent = transforms.JupiterBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "CARPO",
      Observer = "JUPITER BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 3000, 3000, 3000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_jupiter",
    "moon_carpo",
    "moon_minor",
    "moon_minor_jupiter"
  },
  GUI = {
    Name = "Carpo",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/Carpo"
  }
}

local CarpoTrail = {
  Identifier = "CarpoTrail",
  Parent = transforms.JupiterBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "CARPO",
      Observer = "JUPITER BARYCENTER"
    },
    Color = { 0.4, 0.3, 0.01 },
    Period = 458.62,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_jupiter",
    "moonTrail_minor",
    "moonTrail_minor_jupiter"
  },
  GUI = {
    Name = "Carpo Trail",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/Carpo"
  }
}

local CarpoLabel = {
  Identifier = "CarpoLabel",
  Parent = Carpo.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Carpo",
    FontSize = 70.0,
    Size = 7.1,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 1.0, 100.0 },
    FadeWidths = { 0.0, 100.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Carpo Label",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/Carpo",
    Description = "Label for Jupiter's moon Carpo (Carpo group)"
  }
}

local CarpoLabelNear = {
  Identifier = "CarpoLabelNear",
  Parent = Carpo.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "Carpo",
    FontSize = 70.0,
    Size = 5.5,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 0.2, 1.0 },
    FadeWidths = { 0.1, 0.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "Carpo Label (Near)",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/Carpo",
    Description = "Transitional Label for close-range viewing of Carpo (Carpo group)"
  }
}

local S2018J4 = {
  Identifier = "S2018J4",
  Parent = transforms.JupiterBarycenter.Identifier,
  Transform = {
    Translation = {
      Type = "SpiceTranslation",
      Target = "55520",
      Observer = "JUPITER BARYCENTER"
    }
  },
  Renderable = {
    Type = "RenderableGlobe",
    Radii = { 2000, 2000, 2000 },
    SegmentsPerPatch = 64,
    Layers = {}
  },
  Tag = {
    "moon_solarSystem",
    "moon_giants",
    "moon_jupiter",
    "moon_carpo",
    "moon_minor",
    "moon_minor_jupiter"
  },
  GUI = {
    Name = "S/2018 J 4",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/S2018J4"
  }
}

local S2018J4Trail = {
  Identifier = "S2018J4Trail",
  Parent = transforms.JupiterBarycenter.Identifier,
  Renderable = {
    Type = "RenderableTrailOrbit",
    Translation = {
      Type = "SpiceTranslation",
      Target = "55520",
      Observer = "JUPITER BARYCENTER"
    },
    Color = { 0.4, 0.3, 0.01 },
    Period = 458.62,
    Resolution = 1000
  },
  Tag = {
    "moonTrail_solarSystem",
    "moonTrail_giants",
    "moonTrail_jupiter",
    "moonTrail_minor",
    "moonTrail_minor_jupiter"
  },
  GUI = {
    Name = "S/2018 J 4 Trail",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/S2018J4"
  }
}

local S2018J4Label = {
  Identifier = "S2018J4Label",
  Parent = S2018J4.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "S/2018 J 4",
    FontSize = 70.0,
    Size = 7.1,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 1.5, 90.0 },
    FadeWidths = { 0.5, 90.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "S/2018 J 4 Label",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/S2018J4",
    Description = "Label for Jupiter's moon S2018J4 (Carpo group)"
  }
}

local S2018J4LabelNear = {
  Identifier = "S2018J4LabelNear",
  Parent = S2018J4.Identifier,
  Renderable = {
    Enabled = false,
    Type = "RenderableLabel",
    Text = "S2018J4",
    FontSize = 70.0,
    Size = 5.5,
    MinMaxSize = { 1, 25 },
    OrientationOption = "Camera View Direction",
    BlendMode = "Additive",
    EnableFading = true,
    FadeUnit = "Gm",
    FadeDistances = { 0.2, 1.0 },
    FadeWidths = { 0.1, 0.0 }
  },
  Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" },
  GUI = {
    Name = "S2018J4 Label (Near)",
    Path = "/Solar System/Planets/Jupiter/Minor Moons/Carpo Group/S2018J4",
    Description = "Transitional Label for close-range viewing of S2018J4 (Carpo group)"
  }
}


asset.onInitialize(function()
  openspace.spice.loadKernel(kernel.jup344)


  openspace.addSceneGraphNode(Carpo)
  openspace.addSceneGraphNode(CarpoTrail)
  openspace.addSceneGraphNode(CarpoLabel)
  openspace.addSceneGraphNode(CarpoLabelNear)
  openspace.addSceneGraphNode(S2018J4)
  openspace.addSceneGraphNode(S2018J4Trail)
  openspace.addSceneGraphNode(S2018J4Label)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(S2018J4Label)
  openspace.removeSceneGraphNode(S2018J4Trail)
  openspace.removeSceneGraphNode(S2018J4)
  openspace.removeSceneGraphNode(CarpoLabelNear)
  openspace.removeSceneGraphNode(CarpoLabel)
  openspace.removeSceneGraphNode(CarpoTrail)
  openspace.removeSceneGraphNode(Carpo)

  openspace.spice.unloadKernel(kernel.jup344)
end)

asset.export(Carpo)
asset.export(CarpoTrail)
asset.export(CarpoLabel)
asset.export(CarpoLabelNear)
asset.export(S2018J4)
asset.export(S2018J4Trail)
asset.export(S2018J4Label)



asset.meta = {
  Name = "Jupiter Carpo Group Moons",
  Version = "1.0",
  Description = [[Procedural Globe asset containing Jupiter's Carpo Group moons: Carpo.
    Blank globes and SPICE trails are generated for each moon]],
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
