mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
rename autonavigation -> pathnavigation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -56,7 +56,7 @@ AutoNavigationModule::AutoNavigationModule()
|
||||
, _minValidBoundingSphere(MinBoundingSphereInfo, 10.0, 1.0, 3e10)
|
||||
, _relevantNodeTags(RelevantNodeTagsInfo)
|
||||
{
|
||||
addPropertySubOwner(_autoNavigationHandler);
|
||||
addPropertySubOwner(_pathNavigationHandler);
|
||||
addProperty(_minValidBoundingSphere);
|
||||
|
||||
_relevantNodeTags = std::vector<std::string>{
|
||||
@@ -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());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <modules/autonavigation/autonavigationhandler.h>
|
||||
#include <modules/autonavigation/pathnavigationhandler.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
AutoNavigationModule();
|
||||
virtual ~AutoNavigationModule() = default;
|
||||
|
||||
autonavigation::AutoNavigationHandler& AutoNavigationHandler();
|
||||
pathnavigation::PathNavigationHandler& PathNavigationHandler();
|
||||
double minValidBoundingSphere() const;
|
||||
const std::vector<SceneGraphNode*>& 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;
|
||||
|
||||
@@ -38,17 +38,17 @@
|
||||
#include <glm/gtx/vector_angle.hpp>
|
||||
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
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<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
PathNavigationHandler& handler = module->PathNavigationHandler();
|
||||
std::vector<glm::dvec3> 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<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
PathNavigationHandler& handler = module->PathNavigationHandler();
|
||||
std::vector<glm::dquat> 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<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
PathNavigationHandler& handler = module->PathNavigationHandler();
|
||||
std::vector<glm::dvec3> 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<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
PathNavigationHandler& handler = module->PathNavigationHandler();
|
||||
std::vector<glm::dvec3> 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <modules/autonavigation/pathcurve.h>
|
||||
|
||||
namespace openspace::autonavigation {
|
||||
namespace openspace::pathnavigation {
|
||||
|
||||
struct WayPoint;
|
||||
|
||||
@@ -41,6 +41,6 @@ private:
|
||||
std::vector<SceneGraphNode*> _relevantNodes;
|
||||
};
|
||||
|
||||
} // namespace openspace::autonavigation
|
||||
} // namespace openspace::pathnavigation
|
||||
|
||||
#endif // __OPENSPACE_MODULE_AUTONAVIGATION___AVOIDCOLLISIONCURVE___H__
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <modules/autonavigation/pathcurve.h>
|
||||
|
||||
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__
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
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<double(double)> 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<glm::dvec3>& points,
|
||||
const std::vector<double>& tKnots);
|
||||
|
||||
} // namespace openspace::autonavigation::interpolation
|
||||
} // namespace openspace::pathnavigation::interpolation
|
||||
#endif // __OPENSPACE_MODULE_AUTONAVIGATION___HELPERFUNCTIONS___H__
|
||||
|
||||
@@ -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<double> duration)
|
||||
@@ -62,7 +62,7 @@ Path::Path(Waypoint start, Waypoint end, CurveType type,
|
||||
|
||||
const auto defaultDuration = [](double pathlength) {
|
||||
auto module = global::moduleEngine->module<AutoNavigationModule>();
|
||||
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
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <modules/autonavigation/pathcurve.h>
|
||||
#include <modules/autonavigation/waypoint.h>
|
||||
|
||||
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__
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <modules/autonavigation/path.h>
|
||||
|
||||
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__
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <ghoul/glm.h>
|
||||
#include <vector>
|
||||
|
||||
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__
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/autonavigation/autonavigationhandler.h>
|
||||
#include <modules/autonavigation/pathnavigationhandler.h>
|
||||
|
||||
#include <modules/autonavigation/helperfunctions.h>
|
||||
#include <modules/autonavigation/pathcreator.h>
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <vector>
|
||||
|
||||
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<glm::dvec3> AutoNavigationHandler::curvePositions(int nSteps) const {
|
||||
std::vector<glm::dvec3> PathNavigationHandler::curvePositions(int nSteps) const {
|
||||
if (!hasCurrentPath()) {
|
||||
LERROR("There is no current path to sample points from.");
|
||||
return {};
|
||||
@@ -288,7 +288,7 @@ std::vector<glm::dvec3> AutoNavigationHandler::curvePositions(int nSteps) const
|
||||
}
|
||||
|
||||
// Created for debugging
|
||||
std::vector<glm::dquat> AutoNavigationHandler::curveOrientations(int nSteps) const {
|
||||
std::vector<glm::dquat> PathNavigationHandler::curveOrientations(int nSteps) const {
|
||||
if (!hasCurrentPath()) {
|
||||
LERROR("There is no current path to sample points from.");
|
||||
return {};
|
||||
@@ -309,7 +309,7 @@ std::vector<glm::dquat> AutoNavigationHandler::curveOrientations(int nSteps) con
|
||||
|
||||
|
||||
// Created for debugging
|
||||
std::vector<glm::dvec3> AutoNavigationHandler::curveViewDirections(int nSteps) const {
|
||||
std::vector<glm::dvec3> PathNavigationHandler::curveViewDirections(int nSteps) const {
|
||||
if (!hasCurrentPath()) {
|
||||
LERROR("There is no current path to sample points from.");
|
||||
return {};
|
||||
@@ -335,7 +335,7 @@ std::vector<glm::dvec3> AutoNavigationHandler::curveViewDirections(int nSteps) c
|
||||
}
|
||||
|
||||
// Created for debugging
|
||||
std::vector<glm::dvec3> AutoNavigationHandler::controlPoints() const {
|
||||
std::vector<glm::dvec3> PathNavigationHandler::controlPoints() const {
|
||||
if (!hasCurrentPath()) {
|
||||
LERROR("There is no current path to sample points from.");
|
||||
return {};
|
||||
@@ -348,7 +348,7 @@ std::vector<glm::dvec3> 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
|
||||
@@ -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 <modules/autonavigation/path.h>
|
||||
#include <openspace/properties/list/stringlistproperty.h>
|
||||
@@ -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__
|
||||
@@ -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
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <openspace/interaction/navigationhandler.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
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__
|
||||
|
||||
Reference in New Issue
Block a user