mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-06 04:18:36 -06:00
Add lua function to dispatch point spacecraft event
This commit is contained in:
@@ -435,7 +435,8 @@ scripting::LuaLibrary SkyBrowserModule::luaLibrary() const {
|
||||
codegen::lua::FinetuneTargetPosition,
|
||||
codegen::lua::ScrollOverBrowser,
|
||||
codegen::lua::LoadingImageCollectionComplete,
|
||||
codegen::lua::ShowAllTargetsAndBrowsers
|
||||
codegen::lua::ShowAllTargetsAndBrowsers,
|
||||
codegen::lua::PointSpaceCraft
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <modules/skybrowser/include/utility.h>
|
||||
#include <modules/skybrowser/include/targetbrowserpair.h>
|
||||
#include <modules/skybrowser/include/wwtdatahandler.h>
|
||||
#include <openspace/events/eventengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/engine/windowdelegate.h>
|
||||
@@ -757,6 +758,20 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Point spacecraft to the equatorial coordinates the target points to
|
||||
* \param identifier Identifier of the sky browser
|
||||
*/
|
||||
[[codegen::luawrap]] void pointSpaceCraft(std::string identifier) {
|
||||
using namespace openspace;
|
||||
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
|
||||
TargetBrowserPair* pair = module->getPair(identifier);
|
||||
glm::dvec2 equatorial = pair->targetDirectionEquatorial();
|
||||
global::eventEngine->publishEvent<events::EventPointSpacecraft>(
|
||||
equatorial.x, equatorial.y
|
||||
);
|
||||
}
|
||||
|
||||
#include "skybrowsermodule_lua_codegen.cpp"
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user