mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-05 11:09:12 -06:00
- Remove the asset_helper file and call the onInitialize and onDeinitialize functions directly - Small compile fix on Windows - Removes the need for the registerIdentifierWithMeta function by automatically doing that for all asset.export statements - Allow the passing of either identifiers (as before) or entire tables to the removeSceneGraphNode, removeScreenSpaceRenderable, deleteLayer, removeAction, and export methods. In that case, the Identifier key from the table is extracted and used instead
55 lines
1.3 KiB
Lua
55 lines
1.3 KiB
Lua
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 lat = 40.7306
|
|
local long = -73.9352
|
|
|
|
local Example_GlobeRotation = {
|
|
Identifier = "Example_GlobeRotation",
|
|
Parent = earth.Earth.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "GlobeTranslation",
|
|
Globe = earth.Earth.Identifier,
|
|
Latitude = lat,
|
|
Longitude = long,
|
|
Altitude = 6,
|
|
UseHeightmap = true
|
|
},
|
|
Rotation = {
|
|
Type = "GlobeRotation",
|
|
Globe = earth.Earth.Identifier,
|
|
Latitude = lat,
|
|
Longitude = long
|
|
-- Can be used to to put flat on leaning surfaces, but also leads to updating
|
|
-- the rotation every frame
|
|
--UseHeightmap = true
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
Body = "NEW HORIZONS",
|
|
GeometryFile = models .. "NewHorizonsCleanModel.obj"
|
|
},
|
|
GUI = {
|
|
Path = "/Example"
|
|
}
|
|
}
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(Example_GlobeRotation)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(Example_GlobeRotation)
|
|
end)
|
|
|
|
asset.export(Example_GlobeRotation)
|