asset.require("spice/base")
local transforms = asset.require("./transforms")



local textures = asset.syncedResource({
  Type = "HttpSynchronization",
  Name = "Sun textures",
  Identifier = "sun_textures",
  Version = 4
})


local SunGlare = {
  Identifier = "SunGlare",
  Parent = transforms.SunIAU.Identifier,
  Renderable = {
    Type = "RenderablePlaneImageLocal",
    Size = 1.3*10^10.5,
    Origin = "Center",
    Billboard = true,
    Texture = textures .. "halo.png",
    BlendMode = "Additive",
    Opacity = 0.65
  },
  GUI = {
    Name = "Sun Glare",
    Path = "/Solar System/Sun",
    Description = "Sun glare effect. Enabled by default instead of sun globe"
  }
}


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

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

asset.export(SunGlare)



asset.meta = {
  Name = "Sun Glare",
  Version = "1.1",
  Description = "Image plane with sun glare effect",
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
