Files
OpenSpace/data/assets/examples/globerotation.asset
Alexander Bock 0b91fd2642 Global cleanup pass over asset files
- Lua style guides
- FrameConversions
- unloadMission, Add mission identifiers
2024-08-14 10:22:20 +02:00

72 lines
1.8 KiB
Lua

local sun = asset.require("scene/solarsystem/sun/transforms")
local earth = asset.require("scene/solarsystem/planets/earth/earth")
local models = asset.resource({
Name = "New Horizons Model",
Type = "HttpSynchronization",
Identifier = "newhorizons_model",
Version = 2
})
local ExampleGlobeRotation = {
Identifier = "ExampleGlobeRotation",
Parent = earth.Earth.Identifier,
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 40.7306,
Longitude = -73.9352,
Altitude = 6,
UseHeightmap = true
},
Rotation = {
Type = "GlobeRotation",
Globe = earth.Earth.Identifier,
Latitude = 40.7306,
Longitude = -73.9352
-- Can be used to to put flat on leaning surfaces, but also leads to updating
-- the rotation every frame
--UseHeightmap = true
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = models .. "NewHorizonsCleanModel.obj",
LightSources = {
sun.LightSource
}
},
GUI = {
Name = "GlobeRotation",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(ExampleGlobeRotation)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(ExampleGlobeRotation)
end)
asset.export(ExampleGlobeRotation)
asset.meta = {
Name = "GlobeRotation Example",
Description = [[An example that demonstrates how to load a 3D model from a geometry
file, placing it on a planetary surface and rotate it to align with the surface
normal using a "GlobeRotation" transform. Note that "GlobeTranslation" is needed to
put the model in the correct location.]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license"
}