local textures = asset.syncedResource({
  Name = "HII Regions Textures",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_h2regions_textures",
  Version = 1
})

local speck = asset.syncedResource({
  Name = "HII Regions Speck Files",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_h2regions_speck",
  Version = 3
})


local Object = {
  Identifier = "HIIRegions",
  Renderable = {
    Type = "RenderableBillboardsCloud",
    Enabled = false,
    Labels = {
      File = speck .. "h2.label",
      Color = { 0.5, 0.5, 0.5 },
      Size = 16.24,
      MinMaxSize = { 4, 20 },
      Unit = "pc"
    },
    Color = { 0.0, 0.5, 1.0 },
    Opacity = 0.70,
    File = speck .. "h2.speck",
    Texture = textures .. "point4.png",
    PolygonSides = 6,
    Unit = "pc",
    ScaleFactor = 420.0,
    BillboardMinMaxSize = { 0.0, 300.0 },
    EnablePixelSizeControl = false
  },
  GUI = {
    Name = "HII Regions",
    Path = "/Milky Way",
    Description = [[Census: 1,271 nebulae. DU Version 4.6. <br> H ii (pronounced
      H-two) regions are stellar nurseries for newborn stars. Stars are born from
      condensing clouds of hydrogen gas. As these clouds condense, the densities
      become high enough to form stars. From Earth's perspective, you'll notice that
      the H ii regions all lie close to the Galactic plane. This is not an accident
      of nature. These star-forming regions lie in the plane of the Galaxy because
      that is where star formation occurs in spiral galaxies such as our Milky Way.
      Because of this, they are great tracers of the spiral arms of the Galaxy, and
      were instrumental in our understanding of the Galaxy's overall structure
      (Description from URL) <br><br> Data Reference: The WISE catalog of Galactic
      HII Regions (Anderson+, 2014)]]
  }
}


asset.onInitialize(function()
  openspace.addSceneGraphNode(Object)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(Object)
end)

asset.export(Object)



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