local speck = asset.syncedResource({
  Name = "Constellation Speck Files",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_constellations_speck",
  Version = 2
})

local constellationsExtragalactic = {
  Identifier = "ConstellationsExtragalactic",
  Renderable = {
    Type = "RenderableDUMeshes",
    Enabled = false,
    Opacity = 0.4,
    File = speck .. "constellationsEXGAL.speck",
    LabelFile = speck .. "constellationsEXGAL.label",
    TextColor = { 0.8, 0.8, 0.8 },
    TextOpacity = 0.4,
    TextSize = 20.0,
    TextMinMaxSize = { 20, 30 },
    MeshColor = { { 0.6, 0.4, 0.4 }, { 0.8, 0.0, 0.0 }, { 0.0, 0.3, 0.8 } },
    Unit = "Mpc"
  },
  GUI = {
    Name = "Constellations (Extragalactic)",
    Path = "/Milky Way/Constellations"
  }
}

local constellations = {
  Identifier = "Constellations",
  Renderable = {
    Type = "RenderableDUMeshes",
    Enabled = false,
    Opacity = 0.3,
    File = speck .. "constellations.speck",
    LabelFile = speck .. "constellations.label",
    TextColor = { 0.8, 0.8, 0.8 },
    TextOpacity = 0.3,
    TextSize = 14.5,
    TextMinMaxSize = { 8, 170 },
    MeshColor = { { 0.6, 0.4, 0.4 }, { 0.8, 0.0, 0.0 }, { 0.0, 0.3, 0.8 } },
    Unit = "pc"
  },
  GUI = {
      Name = "Constellations",
    Path = "/Milky Way/Constellations",
    Description = [[Census 88 constellations and labels. DU Version 2.3. <br> These
      modern constellations are largely based on those of the Babylonians and
      Greeks; however, most cultures have their own figures and stories of the sky.
      More than half the official constellations adopted by scientists in 1930 were
      known to the ancients over 2,000 years ago. Each star falls into one of these
      88 regions. Of course, today we know the stars in any given constellation do
      not necessarily have any physical relationship with one another. One star may
      be nearby, while an adjacent star in the sky may be far away.(Description
      from URL) <br><br> Data Reference: various]],
  }
}

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



asset.meta = {
  Name = "Constellations",
  Version = "1.1",
  Description = "Digital Universe asset for constellation lines",
  Author = "Brian Abbott (AMNH)",
  URL = "https://www.amnh.org/research/hayden-planetarium/digital-universe",
  License = "AMNH Digital Universe"
}
