local textures = asset.syncedResource({
  Name = "Background Radiation Textures",
  Type = "HttpSynchronization",
  Identifier = "digitaluniverse_backgroundradiation_textures",
  Version = 2
})


local PlanckMultiverse1 = {
  Identifier = "PlanckMultiverse1",
  Transform = {
    Translation = {
      Type = "StaticTranslation",
      Position = { 0.0, 0.0, 2000E23 }
    },
    Rotation = {
      Type = "StaticRotation",
      Rotation = { 0, 0, math.pi }
    }
  },
  Renderable = {
    Type = "RenderableSphere",
    Enabled = false,
    Size = 3975.41417036064E23,
    Segments = 80,
    Opacity = 0.3,
    Texture = textures .. "cmb4k.jpg",
    Orientation = "Both",
    MirrorTexture = true,
    FadeInThreshold = 0.4
  },
  GUI = {
    Name = "Planck Multiverse 1",
    Path = "/Universe/Cosmic Microwave Background"
  }
}

local PlanckMultiverse2 = {
  Identifier = "PlanckMultiverse2",
  Transform = {
    Translation = {
      Type = "StaticTranslation",
      Position = { 2500E23, 0.0, 2000E23}
    },
    Rotation = {
      Type = "StaticRotation",
      Rotation = { 0, 0, math.pi }
    }
  },
  Renderable = {
    Type = "RenderableSphere",
    Enabled = false,
    Size = 3975.41417036064E23,
    Segments = 80,
    Opacity = 0.3,
    Texture = textures .. "cmb4k.jpg",
    Orientation = "Both",
    MirrorTexture = true,
    FadeInThreshold = 0.4
  },
  GUI = {
    Name = "Planck Multiverse 2",
    Path = "/Universe/Cosmic Microwave Background"
  }
}

local PlanckMultiverse3 = {
  Identifier = "PlanckMultiverse3",
  Transform = {
    Translation = {
      Type = "StaticTranslation",
      Position = { 2500E23, 5000E23, 2000E23}
    },
    Rotation = {
      Type = "StaticRotation",
      Rotation = { 0, 0, math.pi }
    }
  },
  Renderable = {
    Type = "RenderableSphere",
    Enabled = false,
    Size = 3975.41417036064E23,
    Segments = 80,
    Opacity = 0.3,
    Texture = textures .. "cmb4k.jpg",
    Orientation = "Both",
    MirrorTexture = true,
    FadeInThreshold = 0.4
  },
  GUI = {
    Name = "Planck Multiverse 3",
    Path = "/Universe/Cosmic Microwave Background"
  }
}

local PlanckMultiverse4 = {
  Identifier = "PlanckMultiverse4",
  Transform = {
    Translation = {
      Type = "StaticTranslation",
      Position = { 0.0, 10000E23, 0.0 }
    },
    Rotation = {
      Type = "StaticRotation",
      Rotation = { 0, 0, math.pi }
    }
  },
  Renderable = {
    Type = "RenderableSphere",
    Enabled = false,
    Size = 3975.41417036064E23,
    Segments = 80,
    Opacity = 0.3,
    Texture = textures .. "cmb4k.jpg",
    Orientation = "Both",
    MirrorTexture = true,
    FadeInThreshold = 0.4
  },
  GUI = {
    Name = "Planck Multiverse 4",
    Path = "/Universe/Cosmic Microwave Background"
  }
}


asset.onInitialize(function()
  openspace.addSceneGraphNode(PlanckMultiverse1)
  openspace.addSceneGraphNode(PlanckMultiverse2)
  openspace.addSceneGraphNode(PlanckMultiverse3)
  openspace.addSceneGraphNode(PlanckMultiverse4)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(PlanckMultiverse4)
  openspace.removeSceneGraphNode(PlanckMultiverse3)
  openspace.removeSceneGraphNode(PlanckMultiverse2)
  openspace.removeSceneGraphNode(PlanckMultiverse1)
end)

asset.export(PlanckMultiverse1)
asset.export(PlanckMultiverse2)
asset.export(PlanckMultiverse3)
asset.export(PlanckMultiverse4)



asset.meta = {
  Name = "Multiverse Background Radiation",
  Version = "2.1",
  Description = [[Non-physical representation of the location of hypothetical cosmic
    microwave background radiation images how they would be observed from other locations
    in the universe. <br> This is not a measured dataset]],
  Author = "Brian Abbott (AMNH), OpenSpace Team",
  URL = "https://www.amnh.org/research/hayden-planetarium/digital-universe",
  License = "AMNH Digital Universe"
}
