local textures = asset.syncedResource({
  Name = "Pulsars Textures",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_pulsars_textures",
  Version = 1
})

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


local Object = {
  Identifier = "Pulsars",
  Renderable = {
    Type = "RenderableBillboardsCloud",
    Enabled = false,
    Labels = {
      File = speck .. "pulsar.label",
      Color = { 0.7, 0.2, 0.2 },
      Size = 15.77,
      MinMaxSize = { 4, 20 },
      Unit = "pc"
    },
    Color = { 0.7, 0.0, 0.0 },
    Opacity = 1.0,
    File = speck .. "pulsar.speck",
    Texture = textures .. "point4.png",
    PolygonSides = 4,
    Unit = "pc",
    ScaleFactor = 424.0,
    BillboardMinMaxSize = { 0.0, 500.0 },
    EnablePixelSizeControl = false
  },
  GUI = {
    Name = "Pulsars",
    Path = "/Milky Way",
    Description = [[Census: 2,498 pulsars. DU Version 5.6. <br> Upon death, stars
      leave behind one of three possible remnants: a white dwarf, a neutron star, or
      a black hole. Stars that are more massive than the sun will often become
      neutron stars in a violent explosion called a supernova. During a supernova,
      the core of the star collapses under such high pressure that the electrons,
      which normally remain outside the atomic nucleus, are forced to combine with
      the protons in the nucleus. Atomic nuclei break apart, producing what is
      called a degenerate state of matter. The collapse is halted when the material
      cannot be packed any tighter. At this point, the star has a radius of about
      10-15 kilometers. The density of this material is so high that a teaspoonful
      would weigh about 100 million tons on Earth. (Description from URL) <br><br>
      Data Reference: ATNF Pulsar Catalogue, (Manchester+, 2005)]]
  }
}


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

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

asset.export(Object)



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