Files
OpenSpace/data/assets/examples/globetranslation.asset
T
2023-03-01 17:31:10 +01:00

72 lines
1.7 KiB
Lua

local sun = asset.require("scene/solarsystem/sun/sun")
local earth = asset.require("scene/solarsystem/planets/earth/earth")
local sunTransforms = asset.require("scene/solarsystem/sun/transforms")
local models = asset.syncedResource({
Name = "New Horizons Model",
Type = "HttpSynchronization",
Identifier = "newhorizons_model",
Version = 2
})
local Example_Fixed_Height = {
Identifier = "Example_Fixed_Height",
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 Example_Adaptive_Height = {
Identifier = "Example_Adaptive_Height",
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(Example_Fixed_Height)
openspace.addSceneGraphNode(Example_Adaptive_Height)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Example_Adaptive_Height)
openspace.removeSceneGraphNode(Example_Fixed_Height)
end)
asset.export(Example_Fixed_Height)
asset.export(Example_Adaptive_Height)