diff --git a/modules/autonavigation/CMakeLists.txt b/modules/autonavigation/CMakeLists.txt index 85b7220af6..ff4571d913 100644 --- a/modules/autonavigation/CMakeLists.txt +++ b/modules/autonavigation/CMakeLists.txt @@ -25,12 +25,12 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/autonavigationhandler.h ${CMAKE_CURRENT_SOURCE_DIR}/autonavigationmodule.h ${CMAKE_CURRENT_SOURCE_DIR}/helperfunctions.h ${CMAKE_CURRENT_SOURCE_DIR}/path.h ${CMAKE_CURRENT_SOURCE_DIR}/pathcreator.h ${CMAKE_CURRENT_SOURCE_DIR}/pathcurve.h + ${CMAKE_CURRENT_SOURCE_DIR}/pathnavigationhandler.h ${CMAKE_CURRENT_SOURCE_DIR}/waypoint.h ${CMAKE_CURRENT_SOURCE_DIR}/curves/avoidcollisioncurve.h ${CMAKE_CURRENT_SOURCE_DIR}/curves/zoomoutoverviewcurve.h @@ -38,13 +38,13 @@ set(HEADER_FILES source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/autonavigationhandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/autonavigationmodule.cpp ${CMAKE_CURRENT_SOURCE_DIR}/autonavigationmodule_lua.inl ${CMAKE_CURRENT_SOURCE_DIR}/helperfunctions.cpp ${CMAKE_CURRENT_SOURCE_DIR}/path.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pathcreator.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pathcurve.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/pathnavigationhandler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/waypoint.cpp ${CMAKE_CURRENT_SOURCE_DIR}/curves/avoidcollisioncurve.cpp ${CMAKE_CURRENT_SOURCE_DIR}/curves/zoomoutoverviewcurve.cpp diff --git a/modules/autonavigation/autonavigationmodule.cpp b/modules/autonavigation/autonavigationmodule.cpp index 8e4ab34e78..f2b632c5a9 100644 --- a/modules/autonavigation/autonavigationmodule.cpp +++ b/modules/autonavigation/autonavigationmodule.cpp @@ -56,7 +56,7 @@ AutoNavigationModule::AutoNavigationModule() , _minValidBoundingSphere(MinBoundingSphereInfo, 10.0, 1.0, 3e10) , _relevantNodeTags(RelevantNodeTagsInfo) { - addPropertySubOwner(_autoNavigationHandler); + addPropertySubOwner(_pathNavigationHandler); addProperty(_minValidBoundingSphere); _relevantNodeTags = std::vector{ @@ -67,8 +67,8 @@ AutoNavigationModule::AutoNavigationModule() addProperty(_relevantNodeTags); } -autonavigation::AutoNavigationHandler& AutoNavigationModule::AutoNavigationHandler() { - return _autoNavigationHandler; +pathnavigation::PathNavigationHandler& AutoNavigationModule::PathNavigationHandler() { + return _pathNavigationHandler; } double AutoNavigationModule::minValidBoundingSphere() const { @@ -132,35 +132,35 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { res.functions = { { "isFlying", - &autonavigation::luascriptfunctions::isFlying, + &pathnavigation::luascriptfunctions::isFlying, {}, "", "Returns true if a camera path is currently running, and false otherwise." }, { "continuePath", - &autonavigation::luascriptfunctions::continuePath, + &pathnavigation::luascriptfunctions::continuePath, {}, "", "Continue playing a paused camera path." }, { "pausePath", - &autonavigation::luascriptfunctions::pausePath, + &pathnavigation::luascriptfunctions::pausePath, {}, "", "Pause a playing camera path." }, { "stopPath", - &autonavigation::luascriptfunctions::stopPath, + &pathnavigation::luascriptfunctions::stopPath, {}, "", "Stops a path, if one is being played." }, { "goTo", - &autonavigation::luascriptfunctions::goTo, + &pathnavigation::luascriptfunctions::goTo, {}, "string [, bool, double]", "Move the camera to the node with the specified name. The optional double " @@ -170,7 +170,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { }, { "goToHeight", - &autonavigation::luascriptfunctions::goToHeight, + &pathnavigation::luascriptfunctions::goToHeight, {}, "string, double [, bool, double]", "Move the camera to the node with the specified name. The second input " @@ -181,7 +181,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { }, { "goToGeo", - &autonavigation::luascriptfunctions::goToGeo, + &pathnavigation::luascriptfunctions::goToGeo, {}, "string, double, double, double [, bool, double]", "Move the camera to the globe with the name given by the input string. " @@ -192,14 +192,14 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { }, { "generatePath", - &autonavigation::luascriptfunctions::generatePath, + &pathnavigation::luascriptfunctions::generatePath, {}, "table", "Generate the path as described by the lua table input argument. " }, { "getPathPositions", - &autonavigation::luascriptfunctions::getPathPositions, + &pathnavigation::luascriptfunctions::getPathPositions, {}, "number", "FOR DEBUG. Sample positions along the path. The input argument is the " @@ -207,7 +207,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { }, { "getPathOrientations", - &autonavigation::luascriptfunctions::getPathOrientations, + &pathnavigation::luascriptfunctions::getPathOrientations, {}, "number", "FOR DEBUG. Sample orientations along the path. The input argument is the " @@ -215,7 +215,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { }, { "getPathViewDirections", - &autonavigation::luascriptfunctions::getPathViewDirections, + &pathnavigation::luascriptfunctions::getPathViewDirections, {}, "number", "FOR DEBUG. Sample view directions along the path. The input argument is " @@ -223,7 +223,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { }, { "getControlPoints", - &autonavigation::luascriptfunctions::getControlPoints, + &pathnavigation::luascriptfunctions::getControlPoints, {}, "", "FOR DEBUG. Get control point positions from all pathsegments" @@ -234,7 +234,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { void AutoNavigationModule::internalInitialize(const ghoul::Dictionary&) { global::callback::preSync->emplace_back([this]() { - _autoNavigationHandler.updateCamera(global::windowDelegate->deltaTime()); + _pathNavigationHandler.updateCamera(global::windowDelegate->deltaTime()); }); } diff --git a/modules/autonavigation/autonavigationmodule.h b/modules/autonavigation/autonavigationmodule.h index 7267e01717..4d848c2e7d 100644 --- a/modules/autonavigation/autonavigationmodule.h +++ b/modules/autonavigation/autonavigationmodule.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace openspace { @@ -39,7 +39,7 @@ public: AutoNavigationModule(); virtual ~AutoNavigationModule() = default; - autonavigation::AutoNavigationHandler& AutoNavigationHandler(); + pathnavigation::PathNavigationHandler& PathNavigationHandler(); double minValidBoundingSphere() const; const std::vector& relevantNodes(); @@ -49,7 +49,7 @@ private: void internalInitialize(const ghoul::Dictionary&) override; void findRelevantNodes(); - autonavigation::AutoNavigationHandler _autoNavigationHandler; + pathnavigation::PathNavigationHandler _pathNavigationHandler; properties::DoubleProperty _minValidBoundingSphere; properties::StringListProperty _relevantNodeTags; diff --git a/modules/autonavigation/autonavigationmodule_lua.inl b/modules/autonavigation/autonavigationmodule_lua.inl index 4d8946d7fa..3972f9705e 100644 --- a/modules/autonavigation/autonavigationmodule_lua.inl +++ b/modules/autonavigation/autonavigationmodule_lua.inl @@ -38,17 +38,17 @@ #include namespace { - constexpr const char* _loggerCat = "AutoNavigation"; + constexpr const char* _loggerCat = "PathNavigation"; constexpr const double Epsilon = 1e-12; } // namespace -namespace openspace::autonavigation::luascriptfunctions { +namespace openspace::pathnavigation::luascriptfunctions { int isFlying(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::isFlying"); AutoNavigationModule* module = global::moduleEngine->module(); - bool hasFinished = module->AutoNavigationHandler().hasFinished(); + bool hasFinished = module->PathNavigationHandler().hasFinished(); ghoul::lua::push(L, !hasFinished); ghoul_assert(lua_gettop(L) == 1, "Incorrect number of items left on stack"); @@ -59,7 +59,7 @@ int continuePath(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::continuePath"); AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().continuePath(); + module->PathNavigationHandler().continuePath(); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; @@ -69,7 +69,7 @@ int pausePath(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::pausePath"); AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().pausePath(); + module->PathNavigationHandler().pausePath(); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; @@ -79,7 +79,7 @@ int stopPath(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::stopPath"); AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().abortPath(); + module->PathNavigationHandler().abortPath(); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; @@ -154,10 +154,10 @@ int goTo(lua_State* L) { } AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().createPath(insDict); + module->PathNavigationHandler().createPath(insDict); - if (module->AutoNavigationHandler().hasCurrentPath()) { - module->AutoNavigationHandler().startPath(); + if (module->PathNavigationHandler().hasCurrentPath()) { + module->PathNavigationHandler().startPath(); } lua_settop(L, 0); @@ -191,10 +191,10 @@ int goToHeight(lua_State* L) { } AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().createPath(insDict); + module->PathNavigationHandler().createPath(insDict); - if (module->AutoNavigationHandler().hasCurrentPath()) { - module->AutoNavigationHandler().startPath(); + if (module->PathNavigationHandler().hasCurrentPath()) { + module->PathNavigationHandler().startPath(); } lua_settop(L, 0); @@ -248,10 +248,10 @@ int goToGeo(lua_State* L) { } AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().createPath(insDict); + module->PathNavigationHandler().createPath(insDict); - if (module->AutoNavigationHandler().hasCurrentPath()) { - module->AutoNavigationHandler().startPath(); + if (module->PathNavigationHandler().hasCurrentPath()) { + module->PathNavigationHandler().startPath(); } lua_settop(L, 0); @@ -266,10 +266,10 @@ int generatePath(lua_State* L) { ghoul::lua::luaDictionaryFromState(L, dictionary); AutoNavigationModule* module = global::moduleEngine->module(); - module->AutoNavigationHandler().createPath(dictionary); + module->PathNavigationHandler().createPath(dictionary); - if (module->AutoNavigationHandler().hasCurrentPath()) { - module->AutoNavigationHandler().startPath(); + if (module->PathNavigationHandler().hasCurrentPath()) { + module->PathNavigationHandler().startPath(); } lua_settop(L, 0); @@ -286,7 +286,7 @@ int getPathPositions(lua_State* L) { // Get sample positions from the current curve AutoNavigationModule* module = global::moduleEngine->module(); - AutoNavigationHandler& handler = module->AutoNavigationHandler(); + PathNavigationHandler& handler = module->PathNavigationHandler(); std::vector points = handler.curvePositions(pointsPerSegment); // Push the points to the Lua stack: @@ -321,7 +321,7 @@ int getPathOrientations(lua_State* L) { // Get sample positions from the current curve AutoNavigationModule* module = global::moduleEngine->module(); - AutoNavigationHandler& handler = module->AutoNavigationHandler(); + PathNavigationHandler& handler = module->PathNavigationHandler(); std::vector orientations = handler.curveOrientations(pointsPerSegment); // Push the rotation to the Lua stack: @@ -358,7 +358,7 @@ int getPathViewDirections(lua_State* L) { // Get sample positions from the current curve AutoNavigationModule* module = global::moduleEngine->module(); - AutoNavigationHandler& handler = module->AutoNavigationHandler(); + PathNavigationHandler& handler = module->PathNavigationHandler(); std::vector viewDirections = handler.curveViewDirections(pointsPerSegment); // Push the points to the Lua stack: @@ -392,7 +392,7 @@ int getControlPoints(lua_State* L) { // Get sample positions from the current curve AutoNavigationModule* module = global::moduleEngine->module(); - AutoNavigationHandler& handler = module->AutoNavigationHandler(); + PathNavigationHandler& handler = module->PathNavigationHandler(); std::vector points = handler.controlPoints(); // Push the points to the Lua stack: @@ -418,4 +418,4 @@ int getControlPoints(lua_State* L) { return 1; } -} // namespace openspace::autonavigation::luascriptfunctions +} // namespace openspace::pathnavigation::luascriptfunctions diff --git a/modules/autonavigation/curves/avoidcollisioncurve.cpp b/modules/autonavigation/curves/avoidcollisioncurve.cpp index 30de058827..90028a36b4 100644 --- a/modules/autonavigation/curves/avoidcollisioncurve.cpp +++ b/modules/autonavigation/curves/avoidcollisioncurve.cpp @@ -45,7 +45,7 @@ namespace { constexpr const int MaxAvoidCollisionSteps = 10; } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { AvoidCollisionCurve::AvoidCollisionCurve(const Waypoint& start, const Waypoint& end) { _relevantNodes = @@ -187,4 +187,4 @@ void AvoidCollisionCurve::removeCollisions(int step) { } } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/curves/avoidcollisioncurve.h b/modules/autonavigation/curves/avoidcollisioncurve.h index 85ae5046cb..8b209633b1 100644 --- a/modules/autonavigation/curves/avoidcollisioncurve.h +++ b/modules/autonavigation/curves/avoidcollisioncurve.h @@ -27,7 +27,7 @@ #include -namespace openspace::autonavigation { +namespace openspace::pathnavigation { struct WayPoint; @@ -41,6 +41,6 @@ private: std::vector _relevantNodes; }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___AVOIDCOLLISIONCURVE___H__ diff --git a/modules/autonavigation/curves/zoomoutoverviewcurve.cpp b/modules/autonavigation/curves/zoomoutoverviewcurve.cpp index e2a4a125ac..4cb80cc6c9 100644 --- a/modules/autonavigation/curves/zoomoutoverviewcurve.cpp +++ b/modules/autonavigation/curves/zoomoutoverviewcurve.cpp @@ -40,7 +40,7 @@ namespace { constexpr const char* _loggerCat = "ZoomOutOverviewCurve"; } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { // Go far out to get a view of both tagets, aimed to match lookAt orientation ZoomOutOverviewCurve::ZoomOutOverviewCurve(const Waypoint& start, const Waypoint& end) { @@ -101,4 +101,4 @@ ZoomOutOverviewCurve::ZoomOutOverviewCurve(const Waypoint& start, const Waypoint initializeParameterData(); } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/curves/zoomoutoverviewcurve.h b/modules/autonavigation/curves/zoomoutoverviewcurve.h index a49ef38fb1..dcbfdb7fcd 100644 --- a/modules/autonavigation/curves/zoomoutoverviewcurve.h +++ b/modules/autonavigation/curves/zoomoutoverviewcurve.h @@ -27,7 +27,7 @@ #include -namespace openspace::autonavigation { +namespace openspace::pathnavigation { struct WayPoint; @@ -36,6 +36,6 @@ public: ZoomOutOverviewCurve(const Waypoint& start, const Waypoint& end); }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___ZOOMOUTOVERVIEWCURVE___H__ diff --git a/modules/autonavigation/helperfunctions.cpp b/modules/autonavigation/helperfunctions.cpp index af555afd29..ccfe2d26a9 100644 --- a/modules/autonavigation/helperfunctions.cpp +++ b/modules/autonavigation/helperfunctions.cpp @@ -31,7 +31,7 @@ namespace { const double Epsilon = 1E-7; } // namespace -namespace openspace::autonavigation::helpers { +namespace openspace::pathnavigation::helpers { // Shift and scale to a subinterval [start,end] double shiftAndScale(double t, double start, double end) { @@ -151,7 +151,7 @@ namespace openspace::autonavigation::helpers { } // helpers -namespace openspace::autonavigation::interpolation { +namespace openspace::pathnavigation::interpolation { glm::dquat easedSlerp(const glm::dquat q1, const glm::dquat q2, double t) { double tScaled = helpers::shiftAndScale(t, 0.1, 0.9); diff --git a/modules/autonavigation/helperfunctions.h b/modules/autonavigation/helperfunctions.h index 330d84b23a..67c6e8a287 100644 --- a/modules/autonavigation/helperfunctions.h +++ b/modules/autonavigation/helperfunctions.h @@ -33,7 +33,7 @@ #include #include -namespace openspace::autonavigation::helpers { +namespace openspace::pathnavigation::helpers { // Make interpolator parameter t [0,1] progress only inside a subinterval double shiftAndScale(double t, double newStart, double newEnd); @@ -51,9 +51,9 @@ namespace openspace::autonavigation::helpers { double fivePointGaussianQuadrature(double t0, double t1, std::function f); -} // namespace openspace::autonavigation::helpers +} // namespace openspace::pathnavigation::helpers -namespace openspace::autonavigation::interpolation { +namespace openspace::pathnavigation::interpolation { glm::dquat easedSlerp(const glm::dquat q1, const glm::dquat q2, double t); @@ -79,5 +79,5 @@ namespace openspace::autonavigation::interpolation { glm::dvec3 piecewiseLinear(double t, const std::vector& points, const std::vector& tKnots); -} // namespace openspace::autonavigation::interpolation +} // namespace openspace::pathnavigation::interpolation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___HELPERFUNCTIONS___H__ diff --git a/modules/autonavigation/path.cpp b/modules/autonavigation/path.cpp index ae17edcafb..a3c7e6e42c 100644 --- a/modules/autonavigation/path.cpp +++ b/modules/autonavigation/path.cpp @@ -39,7 +39,7 @@ namespace { constexpr const char* _loggerCat = "Path"; } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { Path::Path(Waypoint start, Waypoint end, CurveType type, std::optional duration) @@ -62,7 +62,7 @@ Path::Path(Waypoint start, Waypoint end, CurveType type, const auto defaultDuration = [](double pathlength) { auto module = global::moduleEngine->module(); - const double speedScale = module->AutoNavigationHandler().speedScale(); + const double speedScale = module->PathNavigationHandler().speedScale(); return std::log(pathlength) / speedScale; }; @@ -219,4 +219,4 @@ double Path::speedAlongPath(double traveledDistance) { return speed; } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/path.h b/modules/autonavigation/path.h index eb793aa402..8bc570179f 100644 --- a/modules/autonavigation/path.h +++ b/modules/autonavigation/path.h @@ -28,7 +28,7 @@ #include #include -namespace openspace::autonavigation { +namespace openspace::pathnavigation { class Path { public: @@ -74,6 +74,6 @@ private: double _progressedTime = 0.0; // Time since playback started }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___PATH___H__ diff --git a/modules/autonavigation/pathcreator.cpp b/modules/autonavigation/pathcreator.cpp index 85bf4b3808..a5c659fafd 100644 --- a/modules/autonavigation/pathcreator.cpp +++ b/modules/autonavigation/pathcreator.cpp @@ -76,7 +76,7 @@ namespace { #include "pathinstruction_codegen.cpp" } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { using NavigationState = interaction::NavigationHandler::NavigationState; @@ -243,4 +243,4 @@ SceneGraphNode* PathCreator::findNodeNearTarget(const SceneGraphNode* node) { return nullptr; } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/pathcreator.h b/modules/autonavigation/pathcreator.h index 891f26988a..09f2f7ed9c 100644 --- a/modules/autonavigation/pathcreator.h +++ b/modules/autonavigation/pathcreator.h @@ -27,7 +27,7 @@ #include -namespace openspace::autonavigation { +namespace openspace::pathnavigation { class Waypoint; @@ -54,6 +54,6 @@ private: static SceneGraphNode* findNodeNearTarget(const SceneGraphNode* node); }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___PATHCREATOR___H__ diff --git a/modules/autonavigation/pathcurve.cpp b/modules/autonavigation/pathcurve.cpp index 2866cd562f..71bc0c2a34 100644 --- a/modules/autonavigation/pathcurve.cpp +++ b/modules/autonavigation/pathcurve.cpp @@ -37,7 +37,7 @@ namespace { constexpr const int NrSamplesPerSegment = 100; } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { PathCurve::~PathCurve() {} @@ -232,4 +232,4 @@ LinearCurve::LinearCurve(const Waypoint& start, const Waypoint& end) { initializeParameterData(); } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/pathcurve.h b/modules/autonavigation/pathcurve.h index 7a2d326b3c..f6f1431d19 100644 --- a/modules/autonavigation/pathcurve.h +++ b/modules/autonavigation/pathcurve.h @@ -29,7 +29,7 @@ #include #include -namespace openspace::autonavigation { +namespace openspace::pathnavigation { class PathCurve { public: @@ -75,6 +75,6 @@ public: LinearCurve(const Waypoint& start, const Waypoint& end); }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___PATHCURVE___H__ diff --git a/modules/autonavigation/autonavigationhandler.cpp b/modules/autonavigation/pathnavigationhandler.cpp similarity index 90% rename from modules/autonavigation/autonavigationhandler.cpp rename to modules/autonavigation/pathnavigationhandler.cpp index cc17c547d9..ed97361915 100644 --- a/modules/autonavigation/autonavigationhandler.cpp +++ b/modules/autonavigation/pathnavigationhandler.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include @@ -36,7 +36,7 @@ #include namespace { - constexpr const char* _loggerCat = "AutoNavigationHandler"; + constexpr const char* _loggerCat = "PathNavigationHandler"; constexpr openspace::properties::Property::PropertyInfo DefaultCurveOptionInfo = { "DefaultCurveOption", @@ -79,10 +79,10 @@ namespace { }; } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { -AutoNavigationHandler::AutoNavigationHandler() - : properties::PropertyOwner({ "AutoNavigationHandler" }) +PathNavigationHandler::PathNavigationHandler() + : properties::PropertyOwner({ "PathNavigationHandler" }) , _defaultCurveOption( DefaultCurveOptionInfo, properties::OptionProperty::DisplayType::Dropdown @@ -119,25 +119,25 @@ AutoNavigationHandler::AutoNavigationHandler() addProperty(_orbitSpeedFactor); } -AutoNavigationHandler::~AutoNavigationHandler() {} // NOLINT +PathNavigationHandler::~PathNavigationHandler() {} // NOLINT -Camera* AutoNavigationHandler::camera() const { +Camera* PathNavigationHandler::camera() const { return global::navigationHandler->camera(); } -const SceneGraphNode* AutoNavigationHandler::anchor() const { +const SceneGraphNode* PathNavigationHandler::anchor() const { return global::navigationHandler->anchorNode(); } -double AutoNavigationHandler::speedScale() const { +double PathNavigationHandler::speedScale() const { return _speedScale; } -bool AutoNavigationHandler::hasCurrentPath() const { +bool PathNavigationHandler::hasCurrentPath() const { return _currentPath != nullptr; } -bool AutoNavigationHandler::hasFinished() const { +bool PathNavigationHandler::hasFinished() const { if (!hasCurrentPath()) { return true; } @@ -145,7 +145,7 @@ bool AutoNavigationHandler::hasFinished() const { return _currentPath->hasReachedEnd(); } -void AutoNavigationHandler::updateCamera(double deltaTime) { +void PathNavigationHandler::updateCamera(double deltaTime) { ghoul_assert(camera() != nullptr, "Camera must not be nullptr"); if (!_isPlaying) { @@ -190,7 +190,7 @@ void AutoNavigationHandler::updateCamera(double deltaTime) { } } -void AutoNavigationHandler::createPath(const ghoul::Dictionary& dictionary) { +void PathNavigationHandler::createPath(const ghoul::Dictionary& dictionary) { // TODO: Improve how curve types are handled const int curveType = _defaultCurveOption; @@ -208,12 +208,12 @@ void AutoNavigationHandler::createPath(const ghoul::Dictionary& dictionary) { LINFO("Successfully generated camera path"); } -void AutoNavigationHandler::clearPath() { +void PathNavigationHandler::clearPath() { LINFO("Clearing path..."); _currentPath = nullptr; } -void AutoNavigationHandler::startPath() { +void PathNavigationHandler::startPath() { if (!hasCurrentPath()) { LERROR("There is no path to start"); return; @@ -229,7 +229,7 @@ void AutoNavigationHandler::startPath() { _isPlaying = true; } -void AutoNavigationHandler::abortPath() { +void PathNavigationHandler::abortPath() { if (!_isPlaying) { LWARNING("No camera path is playing"); return; @@ -238,7 +238,7 @@ void AutoNavigationHandler::abortPath() { LINFO("Aborted camera path"); } -void AutoNavigationHandler::pausePath() { +void PathNavigationHandler::pausePath() { if (hasFinished()) { LERROR("No path to pause (path is empty or has finished)."); return; @@ -253,7 +253,7 @@ void AutoNavigationHandler::pausePath() { _isPlaying = false; } -void AutoNavigationHandler::continuePath() { +void PathNavigationHandler::continuePath() { if (hasFinished()) { LERROR("No path to resume (path is empty or has finished)."); return; @@ -269,7 +269,7 @@ void AutoNavigationHandler::continuePath() { } // Created for debugging -std::vector AutoNavigationHandler::curvePositions(int nSteps) const { +std::vector PathNavigationHandler::curvePositions(int nSteps) const { if (!hasCurrentPath()) { LERROR("There is no current path to sample points from."); return {}; @@ -288,7 +288,7 @@ std::vector AutoNavigationHandler::curvePositions(int nSteps) const } // Created for debugging -std::vector AutoNavigationHandler::curveOrientations(int nSteps) const { +std::vector PathNavigationHandler::curveOrientations(int nSteps) const { if (!hasCurrentPath()) { LERROR("There is no current path to sample points from."); return {}; @@ -309,7 +309,7 @@ std::vector AutoNavigationHandler::curveOrientations(int nSteps) con // Created for debugging -std::vector AutoNavigationHandler::curveViewDirections(int nSteps) const { +std::vector PathNavigationHandler::curveViewDirections(int nSteps) const { if (!hasCurrentPath()) { LERROR("There is no current path to sample points from."); return {}; @@ -335,7 +335,7 @@ std::vector AutoNavigationHandler::curveViewDirections(int nSteps) c } // Created for debugging -std::vector AutoNavigationHandler::controlPoints() const { +std::vector PathNavigationHandler::controlPoints() const { if (!hasCurrentPath()) { LERROR("There is no current path to sample points from."); return {}; @@ -348,7 +348,7 @@ std::vector AutoNavigationHandler::controlPoints() const { return points; } -void AutoNavigationHandler::removeRollRotation(CameraPose& pose, double deltaTime) { +void PathNavigationHandler::removeRollRotation(CameraPose& pose, double deltaTime) { const glm::dvec3 anchorPos = anchor()->worldPosition(); const glm::dvec3 cameraDir = glm::normalize( pose.rotation * Camera::ViewDirectionCameraSpace @@ -364,7 +364,7 @@ void AutoNavigationHandler::removeRollRotation(CameraPose& pose, double deltaTim pose.rotation = rollFreeRotation; } -void AutoNavigationHandler::applyStopBehavior(double deltaTime) { +void PathNavigationHandler::applyStopBehavior(double deltaTime) { switch (_stopBehavior) { case StopBehavior::None: // Do nothing @@ -377,7 +377,7 @@ void AutoNavigationHandler::applyStopBehavior(double deltaTime) { } } -void AutoNavigationHandler::orbitAnchorNode(double deltaTime) { +void PathNavigationHandler::orbitAnchorNode(double deltaTime) { ghoul_assert(anchor() != nullptr, "Node to orbit must be set!"); const glm::dvec3 prevPosition = camera()->positionVec3(); @@ -420,4 +420,4 @@ void AutoNavigationHandler::orbitAnchorNode(double deltaTime) { camera()->setRotation(newRotation); } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/autonavigationhandler.h b/modules/autonavigation/pathnavigationhandler.h similarity index 90% rename from modules/autonavigation/autonavigationhandler.h rename to modules/autonavigation/pathnavigationhandler.h index 276ff8a1e4..c8517f74ec 100644 --- a/modules/autonavigation/autonavigationhandler.h +++ b/modules/autonavigation/pathnavigationhandler.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_MODULE_AUTONAVIGATION___AUTONAVIGATIONHANDLER___H__ -#define __OPENSPACE_MODULE_AUTONAVIGATION___AUTONAVIGATIONHANDLER___H__ +#ifndef __OPENSPACE_MODULE_AUTONAVIGATION___PATHNAVIGATIONHANDLER___H__ +#define __OPENSPACE_MODULE_AUTONAVIGATION___PATHNAVIGATIONHANDLER___H__ #include #include @@ -35,17 +35,17 @@ namespace openspace { class Camera; } // namespace openspace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { -class AutoNavigationHandler : public properties::PropertyOwner { +class PathNavigationHandler : public properties::PropertyOwner { public: enum StopBehavior { None = 0, Orbit }; - AutoNavigationHandler(); - ~AutoNavigationHandler(); + PathNavigationHandler(); + ~PathNavigationHandler(); // Accessors Camera* camera() const; @@ -87,6 +87,6 @@ private: properties::OptionProperty _stopBehavior; }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation -#endif // __OPENSPACE_MODULE_AUTONAVIGATION___AUTONAVIGATIONHANDLER___H__ +#endif // __OPENSPACE_MODULE_AUTONAVIGATION___PATHNAVIGATIONHANDLER___H__ diff --git a/modules/autonavigation/waypoint.cpp b/modules/autonavigation/waypoint.cpp index c121bf9187..44c1dd9679 100644 --- a/modules/autonavigation/waypoint.cpp +++ b/modules/autonavigation/waypoint.cpp @@ -35,7 +35,7 @@ namespace { constexpr const char* _loggerCat = "Waypoint"; } // namespace -namespace openspace::autonavigation { +namespace openspace::pathnavigation { Waypoint::Waypoint(const glm::dvec3& pos, const glm::dquat& rot, const std::string& ref) : nodeIdentifier(ref) @@ -140,4 +140,4 @@ double Waypoint::findValidBoundingSphere(const SceneGraphNode* node) { return bs; } -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation diff --git a/modules/autonavigation/waypoint.h b/modules/autonavigation/waypoint.h index eef7cc8e5c..8296ebdccc 100644 --- a/modules/autonavigation/waypoint.h +++ b/modules/autonavigation/waypoint.h @@ -28,7 +28,7 @@ #include #include -namespace openspace::autonavigation { +namespace openspace::pathnavigation { struct CameraPose { glm::dvec3 position; @@ -55,6 +55,6 @@ struct Waypoint { double validBoundingSphere = 0.0; // to be able to handle nodes with faulty bounding spheres }; -} // namespace openspace::autonavigation +} // namespace openspace::pathnavigation #endif // __OPENSPACE_MODULE_AUTONAVIGATION___WAYPOINT___H__