local textures = asset.syncedResource({
  Name = "2MASS Textures",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_2mass_textures",
  Version = 2
})

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


local Object = {
  Identifier = "2MASS",
  Renderable = {
    Type = "RenderableBillboardsCloud",
    Enabled = false,
    Color = { 1.0, 0.4, 0.2 },
    Opacity = 1.0,
    File = speck .. "2MASS.speck",
    Unit = "Mpc",
    Texture = textures .. "point3A.png",
    ColorMap = speck .. "lss.cmap",
    ColorOption = { "redshift", "prox5Mpc" },
    ColorRange = { { 0.0, 0.075 }, { 1.0, 50.0 } },
    CorrectionSizeEndDistance = 20.6,
    CorrectionSizeFactor = 15.0,
    ScaleFactor = 510.78,
    BillboardMinMaxSize = { 0.0, 11.15 },
    EnablePixelSizeControl = true
  },
  GUI = {
    Name = "2MASS Galaxies",
    Path = "/Universe/Galaxies",
    Description = [[The Two Micron All-Sky Survey (2MASS) is an infrared survey of the
    sky published in 2003. Because it is looking in the infrared, and this is a composite
    of the 2MASS point-source catalog, most of the light from this survey is starlight. In
    visible light, clouds of gas and dust obscure our view. However, in infrared, the
    longer wavelengths of light can penetrate these clouds without being scattered,
    thereby revealing stars that would normally be hidden to our eye.
    (Description from URL)]]
  }
}


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

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

asset.export(Object)



asset.meta = {
  Name = "2MASS Galaxies",
  Version = "1.1",
  Description = "Digital Universe asset for the Two Micron All-Sky Survey (2MASS) survey",
  Author = "Brian Abbott (AMNH)",
  URL = "https://www.amnh.org/research/hayden-planetarium/digital-universe",
  License = "AMNH Digital Universe"
}
