mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
added more scale objects and helper file (#2605)
* added more scale objects and helper file * Update file identifiers * reworked scale models with node support script * using url sync for models that need to be updated --------- Co-authored-by: Alexander Bock <mail@alexanderbock.eu>
This commit is contained in:
53
modules/globebrowsing/scripts/node_support.lua
Normal file
53
modules/globebrowsing/scripts/node_support.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
openspace.globebrowsing.documentation = {
|
||||
{
|
||||
Name = "setNodePosition",
|
||||
Arguments = { nodeIdentifer = "String", globeIdentifier = "String", latitude = "Number", longitude = "Number", altitude = "Number" },
|
||||
Documentation =
|
||||
"Sets the position of a SceneGraphNode that has GlobeTranslation/GlobeRotations. " ..
|
||||
"Usage: openspace.globebrowsing.setNodePosition(" ..
|
||||
"\"Scale_StatueOfLiberty\", \"Earth\", 40.000, -117.5, optionalAltitude)"
|
||||
},
|
||||
{
|
||||
Name = "setNodePositionFromCamera",
|
||||
Arguments = { nodeIdentifer = "String", useAltitude = "Number" },
|
||||
Documentation =
|
||||
"Sets the position of a SceneGraphNode that has GlobeTranslation/GlobeRotations" ..
|
||||
" to match the camera. Only uses camera position not rotation. If useAltitude" ..
|
||||
" is true, then the position will also be updated to the camera's altitude." ..
|
||||
"Usage: openspace.globebrowsing.setNodePositionFromCamera(" ..
|
||||
"\"Scale_StatueOfLiberty\", optionalUseAltitude)"
|
||||
}
|
||||
}
|
||||
|
||||
openspace.globebrowsing.setNodePosition = function (node_identifer, globe_identifier, lat, lon, altitude)
|
||||
openspace.setParent(node_identifer, globe_identifier)
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Globe', globe_identifier);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Latitude', lat);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Longitude', lon);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Rotation.Globe', globe_identifier);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Rotation.Latitude', lat);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Rotation.Longitude', lon);
|
||||
if (altitude) then
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Altitude', altitude);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Altitude', altitude);
|
||||
end
|
||||
end
|
||||
|
||||
openspace.globebrowsing.setNodePositionFromCamera = function (node_identifer, use_altitude)
|
||||
local lat, lon, alt = openspace.globebrowsing.getGeoPositionForCamera();
|
||||
local camera = openspace.navigation.getNavigationState();
|
||||
openspace.setParent(node_identifer, camera.Anchor)
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Globe', camera.Anchor);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Latitude', lat);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Longitude', lon);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Rotation.Globe', camera.Anchor);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Rotation.Latitude', lat);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Rotation.Longitude', lon);
|
||||
if (use_altitude) then
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Altitude', alt);
|
||||
openspace.setPropertyValueSingle('Scene.' .. node_identifer .. '.Translation.Altitude', alt);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user