local sun = asset.require("scene/solarsystem/sun/sun")
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")



local model = asset.syncedResource({
  Name = "Animated Box",
  Type = "HttpSynchronization",
  Identifier = "animated_box",
  Version = 1
})


local Model = {
  Identifier = "ModelShader",
  Parent = transforms.EarthCenter.Identifier,
  Transform = {
    Translation = {
      Type = "StaticTranslation",
      Position = { -11E7, 0.0, 0.0 }
    }
  },
  Renderable = {
    Type = "RenderableModel",
    GeometryFile = model .. "BoxAnimated.glb",
    ModelScale = 3E7,
    -- (malej 2023-MAY-22) Note that PerformShading should be false in this example,
    -- these example shaders dont't contain any light calculations
    PerformShading = false,
    VertexShader = asset.localResource("model_vs.glsl"),
    FragmentShader = asset.localResource("model_fs.glsl"),
    EnableAnimation = true,
    AnimationStartTime = "2023 05 11 00:00:00",
    AnimationTimeScale = "Second",
    AnimationMode = "LoopInfinitely"
  },
  GUI = {
    Name = "Model Shader",
    Path = "/Example",
    Description = "Simple box model with a custom shader"
  }
}


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

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

asset.export(Model)
