local textures = asset.syncedResource({
  Name = "Brown Dwarf Textures",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_dwarfs_textures",
  Version = 1
})

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

local object = {
  Identifier = "Dwarfs",
  Renderable = {
    Type = "RenderableBillboardsCloud",
    Enabled = false,
    Color = { 0.4, 0.0, 0.1 },
    Opacity = 1.0,
    File = speck .. "dwarfs.speck",
    Texture = textures .. "point3.png",
    LabelFile = speck .. "dwarfs.label",
    Unit = "pc",
    ColorMap = speck .. "dwarfs.cmap",
    ColorOption = { "typeindex" },
    --ColorRange = { { 1.0, 4.0} },
    TextColor = { 0.5, 0.1, 0.2 },
    TextSize = 14.6,
    TextMinMaxSize = { 10, 20 },
    ScaleFactor = 372.1,
    --CorrectionSizeEndDistance = 16.1,
    --CorrectionSizeFactor = 7.75,
    BillboardMinMaxSize = { 0.0, 20.0 },
    EnablePixelSizeControl = true
  },
  GUI = {
    Name = "Brown Dwarfs",
    Path = "/Milky Way",
    Description = [[Census: 785 L dwarfs, 101 T dwarfs, 17 Y dwarfs. DU Version 6.4.
      <br> In astronomy, there are dwarf stars-red, white, and brown-dwarf novae,
      and even dwarf galaxies. As you might imagine, astronomers use the term dwarf
      when they refer to the smaller objects in any given class. For decades it was
      believed that M stars were the coolest stars in the Galaxy. Some M stars,
      called red dwarfs, make up 70% of the stars in the Galaxy, including our
      nearest known neighbor, Proxima Centauri. However, a new class of objects,
      even cooler than M stars, was recently discovered and given a spectral type
      of L. L-type objects straddle the boundary between red dwarfs and brown
      dwarfs, the latter of which are not massive enough to ignite the nuclear
      processes necessary for it to shine as a star. L-type objects are typically
      very dim stars or brown dwarfs. Even cooler than L-type objects are T-type
      objects. These are mostly brown dwarfs and resemble large, massive,
      Jupiter-like objects, too large to be planets and typically too small to be
      stars. Beyond the T dwarfs are the Y-type objects, which are even more
      dim.(Description from URL) <br><br> Data Reference: The Brown Dwarf Kinematics
      Project (Faherty+ 2019)]]
  }
}

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



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