local textures = asset.syncedResource({
  Name = "Open Clusters Textures",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_openclusters_textures",
  Version = 1
})

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

local object = {
  Identifier = "OpenStarClusters",
  Renderable = {
    Type = "RenderableBillboardsCloud",
    Enabled = false,
    Color = { 0.1, 0.8, 0.4 },
    Opacity = 0.5,
    File = speck .. "oc.speck",
    Unit = "pc",
    Texture = textures .. "point4.png",
    PolygonSides = 12,
    TextColor = { 0.05, 0.4, 0.2 },
    LabelFile = speck .. "oc.label",
    ScaleFactor = 405.75,
    TextSize = 15.5,
    TextMinMaxSize = { 4, 30 },
    BillboardMinMaxSize = { 0.0, 604.0 },
    EnablePixelSizeControl = true
  },
  GUI = {
    Name = "Open Star Clusters",
    Path = "/Milky Way",
    Description = [[Census: 2,040 clusters. DU Version 5.7. <br> 
      An open star cluster is a loose assemblage of stars numbering from
      hundreds to thousands that are bound by their mutual gravitation.
      Astronomers know from their stellar spectra that stars in open clusters 
      are typically young. (With a star's spectrum, we can determine
      the spectral type and the luminosity class, revealing the star's age.)
      Because these are young stars, we expect to see them in the
      star-forming regions of our Galaxy, namely in the spiral arms. For
      this reason, open clusters exist, for the most part, in the plane of the
      Galaxy, where we view the arms edge-on as that band of light in
      the night sky. Because of this, open clusters were originally known
      as Galactic clusters, but this term fell out of favor once astronomers
      began to understand that the Galaxy includes objects beyond the
      Milky Way's disk. <br><br> Data Reference: Optically
      visible open clusters and Candidates (Dias+ 2002-2015)]],
  }
}

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



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