local sphereTextures = asset.syncedResource({
  Name = "Milky Way Sphere Textures",
  Type = "HttpSynchronization",
  Identifier = "milkyway_textures",
  Version = 2
})


local Sphere = {
  Identifier = "MilkyWay",
  Transform = {
    Rotation = {
      Type = "StaticRotation",
      Rotation = { 0, 0, math.pi }
    }
  },
  Renderable = {
    Type = "RenderableSphere",
    Size = 9.2E21,
    Segments = 40,
    Opacity = 0.25,
    Texture = sphereTextures .. "DarkUniverse_mellinger_4k.jpg",
    Orientation = "Inside",
    MirrorTexture = true,
    FadeOutThreshold = 0.0015,
    Background = true,
    DimInAtmosphere = true
  },
  Tag = { "daytime_hidden" },
  GUI = {
    Name = "Milky Way Sphere",
    Path = "/Milky Way",
    Description = [[All sky image of the Milky Way that is visible when inside. Fades
      out when zooming away from the Milky Way]]
  }
}


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

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

asset.export(Sphere)



asset.meta = {
  Name = "Milky Way Galaxy Sphere",
  Version = "2.1",
  Description = "All sky image of the Milky Way",
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
