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



local models = asset.syncedResource({
  Name = "New Horizons Model",
  Type = "HttpSynchronization",
  Identifier = "newhorizons_model",
  Version = 2
})


local ExampleFixedHeight = {
  Identifier = "ExampleFixedHeight",
  Parent = earth.Earth.Identifier,
  Transform = {
    Translation = {
      Type = "GlobeTranslation",
      Globe = earth.Earth.Identifier,
      Latitude = 40.7128,
      Longitude = -74.006,
      Altitude = 100000.0
    }
  },
  Renderable = {
    Type = "RenderableModel",
    GeometryFile = models .. "NewHorizonsCleanModel.obj",
    LightSources = {
      sun.LightSource
    }
  },
  GUI = {
    Path = "/Example"
  }
}

local ExampleAdaptiveHeight = {
  Identifier = "ExampleAdaptiveHeight",
  Parent = earth.Earth.Identifier,
  Transform = {
    Translation = {
      Type = "GlobeTranslation",
      Globe = earth.Earth.Identifier,
      Latitude = 40.7128,
      Longitude = -74.006,
      UseHeightmap = true
    }
  },
  Renderable = {
    Type = "RenderableModel",
    GeometryFile = models .. "NewHorizonsCleanModel.obj",
    LightSources = {
      sun.LightSource
    }
  },
  GUI = {
    Path = "/Example"
  }
}


asset.onInitialize(function()
  openspace.addSceneGraphNode(ExampleFixedHeight)
  openspace.addSceneGraphNode(ExampleAdaptiveHeight)
end)

asset.onDeinitialize(function()
  openspace.removeSceneGraphNode(ExampleAdaptiveHeight)
  openspace.removeSceneGraphNode(ExampleFixedHeight)
end)

asset.export(ExampleFixedHeight)
asset.export(ExampleAdaptiveHeight)
