mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Add a new Lua function to create debug axes for the current focus node
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/scripting/lualibrary.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <ghoul/misc/templatefactory.h>
|
||||
@@ -63,13 +64,16 @@ std::vector<documentation::Documentation> DebuggingModule::documentations() cons
|
||||
|
||||
scripting::LuaLibrary DebuggingModule::luaLibrary() const {
|
||||
return {
|
||||
"debugging",
|
||||
{
|
||||
.name = "debugging",
|
||||
.functions = {
|
||||
codegen::lua::RenderCameraPath,
|
||||
codegen::lua::RemoveRenderedCameraPath,
|
||||
codegen::lua::RenderPathControlPoints,
|
||||
codegen::lua::RemovePathControlPoints,
|
||||
codegen::lua::AddCartesianAxes
|
||||
},
|
||||
.scripts = {
|
||||
absPath("${MODULE_DEBUGGING}/scripts/axes.lua")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
35
modules/debugging/scripts/axes.lua
Normal file
35
modules/debugging/scripts/axes.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
openspace.debugging.documentation = {
|
||||
{
|
||||
Name = "createCoordinateAxes",
|
||||
Arguments = {},
|
||||
Documentation = [[
|
||||
Creates a new scene graph node that show the coordinate system used for the
|
||||
currently selected focus node.
|
||||
]]
|
||||
}
|
||||
}
|
||||
|
||||
openspace.debugging.createCoordinateAxes = function ()
|
||||
local anchor = openspace.navigation.getNavigationState().Anchor
|
||||
local radius = openspace.propertyValue("Scene." .. anchor .. ".EvaluatedInteractionSphere")
|
||||
|
||||
local node = {
|
||||
Identifier = anchor .. "_DebugAxes",
|
||||
Parent = anchor,
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
Scale = radius * 2.5
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableCartesianAxes"
|
||||
},
|
||||
GUI = {
|
||||
Name = anchor .. " (Debug Axes)",
|
||||
Path = openspace.propertyValue("Scene." .. anchor .. ".GuiPath")
|
||||
}
|
||||
}
|
||||
|
||||
openspace.addSceneGraphNode(node)
|
||||
end
|
||||
Reference in New Issue
Block a user