From 353b950fc6dd809fc2f1f8fa3e6de3643faf8324 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Tue, 27 Oct 2020 08:51:49 +0100 Subject: [PATCH] Adapt to new master: Pointer notation for globals --- modules/autonavigation/atnodenavigator.cpp | 4 ++-- .../autonavigation/autonavigationhandler.cpp | 14 +++++++------- .../autonavigation/autonavigationmodule.cpp | 2 +- .../autonavigationmodule_lua.inl | 18 +++++++++--------- modules/autonavigation/avoidcollisioncurve.cpp | 2 +- modules/autonavigation/instruction.cpp | 2 +- modules/autonavigation/pathsegment.cpp | 4 ++-- modules/autonavigation/waypoint.cpp | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/modules/autonavigation/atnodenavigator.cpp b/modules/autonavigation/atnodenavigator.cpp index edb31897ad..3a531aa0f1 100644 --- a/modules/autonavigation/atnodenavigator.cpp +++ b/modules/autonavigation/atnodenavigator.cpp @@ -82,11 +82,11 @@ void AtNodeNavigator::updateCamera(double deltaTime) { } Camera* AtNodeNavigator::camera() const { - return global::navigationHandler.camera(); + return global::navigationHandler->camera(); } const SceneGraphNode* AtNodeNavigator::anchor() const { - return global::navigationHandler.anchorNode(); + return global::navigationHandler->anchorNode(); } // Move along the right vector for the camera, while looking at the center of the node diff --git a/modules/autonavigation/autonavigationhandler.cpp b/modules/autonavigation/autonavigationhandler.cpp index df01715641..2c4ee6a3c9 100644 --- a/modules/autonavigation/autonavigationhandler.cpp +++ b/modules/autonavigation/autonavigationhandler.cpp @@ -157,11 +157,11 @@ AutoNavigationHandler::AutoNavigationHandler() AutoNavigationHandler::~AutoNavigationHandler() {} // NOLINT Camera* AutoNavigationHandler::camera() const { - return global::navigationHandler.camera(); + return global::navigationHandler->camera(); } const SceneGraphNode* AutoNavigationHandler::anchor() const { - return global::navigationHandler.anchorNode(); + return global::navigationHandler->anchorNode(); } bool AutoNavigationHandler::hasFinished() const { @@ -211,7 +211,7 @@ void AutoNavigationHandler::updateCamera(double deltaTime) { // navigation when we reach the end. std::string currentAnchor = anchor()->identifier(); if (currentAnchor != newAnchor) { - global::navigationHandler.orbitalNavigator().setAnchorNode(newAnchor); + global::navigationHandler->orbitalNavigator().setAnchorNode(newAnchor); } if (!_includeRoll) { @@ -296,10 +296,10 @@ void AutoNavigationHandler::startPath() { ); // TODO: remove this line at the end of our project. Used to simplify testing - global::timeManager.setPause(true); + global::timeManager->setPause(true); //OBS! Until we can handle simulation time: early out if not paused - if (!global::timeManager.isPaused()) { + if (!global::timeManager->isPaused()) { LERROR("Simulation time must be paused to run a camera path."); return; } @@ -430,7 +430,7 @@ std::vector AutoNavigationHandler::getControlPoints() { Waypoint AutoNavigationHandler::wayPointFromCamera() { const glm::dvec3 pos = camera()->positionVec3(); const glm::dquat rot = camera()->rotationQuaternion(); - const std::string node = global::navigationHandler.anchorNode()->identifier(); + const std::string node = global::navigationHandler->anchorNode()->identifier(); return Waypoint{ pos, rot, node }; } @@ -654,7 +654,7 @@ Waypoint AutoNavigationHandler::computeDefaultWaypoint(const TargetNodeInstructi std::vector AutoNavigationHandler::findRelevantNodes() { const std::vector& allNodes = - global::renderEngine.scene()->allSceneGraphNodes(); + global::renderEngine->scene()->allSceneGraphNodes(); const std::vector relevantTags = _relevantNodeTags; diff --git a/modules/autonavigation/autonavigationmodule.cpp b/modules/autonavigation/autonavigationmodule.cpp index eba47db89e..fad1d397a6 100644 --- a/modules/autonavigation/autonavigationmodule.cpp +++ b/modules/autonavigation/autonavigationmodule.cpp @@ -142,7 +142,7 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const { void AutoNavigationModule::internalInitialize(const ghoul::Dictionary&) { global::callback::preSync.emplace_back([this]() { - _autoNavigationHandler.updateCamera(global::windowDelegate.deltaTime()); + _autoNavigationHandler.updateCamera(global::windowDelegate->deltaTime()); }); } diff --git a/modules/autonavigation/autonavigationmodule_lua.inl b/modules/autonavigation/autonavigationmodule_lua.inl index 2f43549e2c..ce388e35ae 100644 --- a/modules/autonavigation/autonavigationmodule_lua.inl +++ b/modules/autonavigation/autonavigationmodule_lua.inl @@ -44,7 +44,7 @@ namespace openspace::autonavigation::luascriptfunctions { int continuePath(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::continuePath"); - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); handler.continuePath(); @@ -54,7 +54,7 @@ namespace openspace::autonavigation::luascriptfunctions { int stopPath(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::stopPath"); - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); handler.abortPath(); @@ -85,7 +85,7 @@ namespace openspace::autonavigation::luascriptfunctions { PathSpecification spec = PathSpecification(TargetNodeInstruction{insDict}); - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); handler.createPath(spec); @@ -108,7 +108,7 @@ namespace openspace::autonavigation::luascriptfunctions { ); } - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); handler.createPath(spec); @@ -160,7 +160,7 @@ namespace openspace::autonavigation::luascriptfunctions { LINFOC("AutoNavigationModule", "Reading succeeded. Creating path"); - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); handler.createPath(spec); @@ -176,7 +176,7 @@ namespace openspace::autonavigation::luascriptfunctions { const int pointsPerSegment = (int)ghoul::lua::value(L, 1); // Get sample positions from the current curve - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); std::vector points = handler.getCurvePositions(pointsPerSegment); @@ -211,7 +211,7 @@ namespace openspace::autonavigation::luascriptfunctions { const int pointsPerSegment = (int)ghoul::lua::value(L, 1); // Get sample positions from the current curve - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); std::vector orientations = handler.getCurveOrientations(pointsPerSegment); @@ -248,7 +248,7 @@ namespace openspace::autonavigation::luascriptfunctions { const int pointsPerSegment = (int)ghoul::lua::value(L, 1); // Get sample positions from the current curve - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); std::vector viewDirections = handler.getCurveViewDirections(pointsPerSegment); @@ -283,7 +283,7 @@ namespace openspace::autonavigation::luascriptfunctions { ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getControlPoints"); // Get sample positions from the current curve - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); std::vector points = handler.getControlPoints(); diff --git a/modules/autonavigation/avoidcollisioncurve.cpp b/modules/autonavigation/avoidcollisioncurve.cpp index f52f14c2d8..d5bc1a5b34 100644 --- a/modules/autonavigation/avoidcollisioncurve.cpp +++ b/modules/autonavigation/avoidcollisioncurve.cpp @@ -50,7 +50,7 @@ namespace { namespace openspace::autonavigation { AvoidCollisionCurve::AvoidCollisionCurve(const Waypoint& start, const Waypoint& end) { - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); _relevantNodes = module->AutoNavigationHandler().relevantNodes(); glm::dvec3 startNodeCenter = start.node()->worldPosition(); diff --git a/modules/autonavigation/instruction.cpp b/modules/autonavigation/instruction.cpp index 29f499e263..b60125130c 100644 --- a/modules/autonavigation/instruction.cpp +++ b/modules/autonavigation/instruction.cpp @@ -113,7 +113,7 @@ std::vector TargetNodeInstruction::getWaypoints() const { targetPos = targetNode->worldPosition() + targetNode->worldRotationMatrix() * position.value(); - Camera* camera = global::navigationHandler.camera(); + Camera* camera = global::navigationHandler->camera(); glm::dmat4 lookAtMat = glm::lookAt( targetPos, diff --git a/modules/autonavigation/pathsegment.cpp b/modules/autonavigation/pathsegment.cpp index 1d210f5b60..94fc358e7b 100644 --- a/modules/autonavigation/pathsegment.cpp +++ b/modules/autonavigation/pathsegment.cpp @@ -55,7 +55,7 @@ PathSegment::PathSegment(Waypoint start, Waypoint end, CurveType type, else { _duration = std::log(pathLength()); - auto module = global::moduleEngine.module(); + auto module = global::moduleEngine->module(); _duration /= module->AutoNavigationHandler().speedScale(); } } @@ -85,7 +85,7 @@ CameraPose PathSegment::traversePath(double dt) { return _start.pose; } - AutoNavigationModule* module = global::moduleEngine.module(); + AutoNavigationModule* module = global::moduleEngine->module(); AutoNavigationHandler& handler = module->AutoNavigationHandler(); const int nrSteps = handler.nrSimulationStepsPerFrame(); diff --git a/modules/autonavigation/waypoint.cpp b/modules/autonavigation/waypoint.cpp index b5c1af71ac..7f38986485 100644 --- a/modules/autonavigation/waypoint.cpp +++ b/modules/autonavigation/waypoint.cpp @@ -51,7 +51,7 @@ WaypointNodeDetails::WaypointNodeDetails(const std::string nodeIdentifier) { double WaypointNodeDetails::findValidBoundingSphere(const SceneGraphNode* node) { double bs = static_cast(node->boundingSphere()); const double minValidBoundingSphere = - global::moduleEngine.module()->minValidBoundingSphere(); + global::moduleEngine->module()->minValidBoundingSphere(); if (bs < minValidBoundingSphere) {