mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-18 09:58:59 -05:00
Only provide a single Lua function for creating debug axes
This commit is contained in:
@@ -1,35 +1,47 @@
|
||||
openspace.debugging.documentation = {
|
||||
{
|
||||
Name = "createCoordinateAxes",
|
||||
Arguments = {},
|
||||
Arguments = {
|
||||
{ "nodeIdentifier", "String?" },
|
||||
{ "scale", "Number?" }
|
||||
},
|
||||
Documentation = [[
|
||||
Creates a new scene graph node that show the coordinate system used for the
|
||||
currently selected focus node.
|
||||
currently selected focus node. The first argument specifies the name of the
|
||||
scene graph node for which the axes should be added. If this parameter is
|
||||
not specified, the current focus node is used instead. The second argument
|
||||
provides the length of the coordinate axis in meters. If this value is not
|
||||
specified 2.5 times the interaction sphere of the selected node is used
|
||||
instead.
|
||||
]]
|
||||
}
|
||||
}
|
||||
|
||||
openspace.debugging.createCoordinateAxes = function ()
|
||||
local anchor = openspace.navigation.getNavigationState().Anchor
|
||||
local radius = openspace.propertyValue("Scene." .. anchor .. ".EvaluatedInteractionSphere")
|
||||
openspace.debugging.createCoordinateAxes = function (nodeIdentifier, scale)
|
||||
local node = nodeIdentifier or openspace.navigation.getNavigationState().Anchor
|
||||
local sphere = openspace.propertyValue("Scene." .. node .. ".EvaluatedInteractionSphere")
|
||||
if sphere == -1 then
|
||||
sphere = 1
|
||||
end
|
||||
local size = scale or sphere * 2.5
|
||||
|
||||
local node = {
|
||||
Identifier = anchor .. "_DebugAxes",
|
||||
Parent = anchor,
|
||||
local nodespec = {
|
||||
Identifier = node .. "_DebugAxes",
|
||||
Parent = node,
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
Scale = radius * 2.5
|
||||
Scale = size
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = anchor .. " (Debug Axes)",
|
||||
Path = openspace.propertyValue("Scene." .. anchor .. ".GuiPath")
|
||||
Name = node .. " (Debug Axes)",
|
||||
Path = openspace.propertyValue("Scene." .. node .. ".GuiPath")
|
||||
}
|
||||
}
|
||||
|
||||
openspace.addSceneGraphNode(node)
|
||||
openspace.addSceneGraphNode(nodespec)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user