mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-29 15:29:26 -05:00
70 lines
1.7 KiB
Lua
70 lines
1.7 KiB
Lua
local sun = asset.require("scene/solarsystem/sun/sun")
|
|
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 = {
|
|
Path = "/Example"
|
|
}
|
|
}
|
|
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(ExampleGlobeRotation)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(ExampleGlobeRotation)
|
|
end)
|
|
|
|
asset.export(ExampleGlobeRotation)
|
|
|
|
|
|
asset.meta = {
|
|
Name = "Model Example",
|
|
Version = "1.0",
|
|
Description = [[An example that demonstrates how to load a 3D model from a geometry
|
|
file, together with some basic functionality. The model is placed on the surface
|
|
of a planet using a GlobeRotation and GlobeTranslation.]],
|
|
Author = "OpenSpace Team",
|
|
URL = "http://openspaceproject.com",
|
|
License = "MIT license"
|
|
}
|