From 04130fe68af09a37dd812cafa7ae0fa84a823d5e Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 25 Sep 2020 16:11:56 +0200 Subject: [PATCH] Do some initial cleanup --- .../autonavigation/autonavigationhandler.cpp | 63 +++++++++++-------- .../autonavigation/autonavigationhandler.h | 6 +- .../autonavigation/autonavigationmodule.cpp | 14 ++--- .../autonavigationmodule_lua.inl | 4 +- .../autonavigation/avoidcollisioncurve.cpp | 40 ++++++------ modules/autonavigation/helperfunctions.cpp | 10 +-- modules/autonavigation/helperfunctions.h | 6 +- modules/autonavigation/instruction.cpp | 6 +- modules/autonavigation/pathcurves.cpp | 14 ++--- modules/autonavigation/pathcurves.h | 2 +- modules/autonavigation/pathsegment.cpp | 15 ++--- modules/autonavigation/pathsegment.h | 12 ++-- modules/autonavigation/pathspecification.cpp | 12 ++-- modules/autonavigation/pathspecification.h | 4 +- .../autonavigation/rotationinterpolator.cpp | 12 ++-- modules/autonavigation/speedfunction.h | 6 +- modules/autonavigation/waypoint.cpp | 41 ++++++------ modules/autonavigation/waypoint.h | 4 +- .../autonavigation/zoomoutoverviewcurve.cpp | 8 +-- 19 files changed, 145 insertions(+), 134 deletions(-) diff --git a/modules/autonavigation/autonavigationhandler.cpp b/modules/autonavigation/autonavigationhandler.cpp index d7c806c320..668d120f84 100644 --- a/modules/autonavigation/autonavigationhandler.cpp +++ b/modules/autonavigation/autonavigationhandler.cpp @@ -115,9 +115,9 @@ AutoNavigationHandler::AutoNavigationHandler() , _defaultStopBehavior(DefaultStopBehaviorInfo, properties::OptionProperty::DisplayType::Dropdown) , _applyStopBehaviorWhenIdle(ApplyStopBehaviorWhenIdleInfo, false) , _relevantNodeTags(RelevantNodeTagsInfo) - , _defaultPositionOffsetAngle(DefaultPositionOffsetAngleInfo, 30.0f, -90.0f, 90.0f) + , _defaultPositionOffsetAngle(DefaultPositionOffsetAngleInfo, 30.f, -90.f, 90.f) , _nrSimulationSteps(NumberSimulationStepsInfo, 5, 2 , 10) - , _speedScale(SpeedScaleInfo, 1.0f, 0.01f, 2.0f) + , _speedScale(SpeedScaleInfo, 1.f, 0.01f, 2.f) { addPropertySubOwner(_atNodeNavigator); @@ -125,7 +125,7 @@ AutoNavigationHandler::AutoNavigationHandler() { CurveType::AvoidCollision, "AvoidCollision" }, { CurveType::Bezier3, "Bezier3" }, { CurveType::Linear, "Linear" }, - { CurveType::ZoomOutOverview, "ZoomOutOverview"} + { CurveType::ZoomOutOverview, "ZoomOutOverview"} }); addProperty(_defaultCurveOption); @@ -166,7 +166,7 @@ const SceneGraphNode* AutoNavigationHandler::anchor() const { bool AutoNavigationHandler::hasFinished() const { unsigned int lastIndex = (unsigned int)_pathSegments.size() - 1; - return _currentSegmentIndex > lastIndex; + return _currentSegmentIndex > lastIndex; } const std::vector& AutoNavigationHandler::relevantNodes() const { @@ -188,7 +188,9 @@ void AutoNavigationHandler::updateCamera(double deltaTime) { // for testing, apply at node behavior when idle if (_applyStopBehaviorWhenIdle) { if (_atNodeNavigator.behavior() != _defaultStopBehavior.value()) { - _atNodeNavigator.setBehavior(AtNodeNavigator::Behavior(_defaultStopBehavior.value())); + _atNodeNavigator.setBehavior( + AtNodeNavigator::Behavior(_defaultStopBehavior.value()) + ); } _atNodeNavigator.updateCamera(deltaTime); } @@ -246,7 +248,7 @@ void AutoNavigationHandler::createPath(PathSpecification& spec) { if (spec.stopAtTargetsSpecified()) { _stopAtTargetsPerDefault = spec.stopAtTargets(); - LINFO("Property for stop at targets per default was overridden by path specification."); + LINFO("Property for stop at targets per default was overridden by path specification."); } const int nrInstructions = (int)spec.instructions()->size(); @@ -289,7 +291,7 @@ void AutoNavigationHandler::startPath() { } ghoul_assert( - _stops.size() == (_pathSegments.size() - 1), + _stops.size() == (_pathSegments.size() - 1), "Must have exactly one stop entry between every segment." ); @@ -393,7 +395,7 @@ std::vector AutoNavigationHandler::getCurveViewDirections(int nPerSe glm::dquat orientation = p->interpolatedPose(u).rotation; glm::dvec3 direction = glm::normalize(orientation * glm::dvec3(0.0, 0.0, -1.0)); viewDirections.push_back(direction); - } + } glm::dquat orientation = p->interpolatedPose(1.0).rotation; glm::dvec3 direction = glm::normalize(orientation * glm::dvec3(0.0, 0.0, -1.0)); viewDirections.push_back(direction); @@ -463,7 +465,7 @@ void AutoNavigationHandler::pauseAtTarget(int i) { bool hasDuration = _activeStop->duration.has_value(); - std::string infoString = hasDuration ? + std::string infoString = hasDuration ? fmt::format("{} seconds", _activeStop->duration.value()) : "until continued"; LINFO(fmt::format("Paused path at target {} / {} ({})", @@ -501,7 +503,8 @@ void AutoNavigationHandler::addSegment(Instruction* ins, int index) { } else { LWARNING(fmt::format( - "No path segment was created from instruction {}. No waypoints could be created.", + "No path segment was created from instruction {}. " + "No waypoints could be created.", index )); return; @@ -513,9 +516,9 @@ void AutoNavigationHandler::addSegment(Instruction* ins, int index) { } _pathSegments.push_back(std::make_unique( - lastWayPoint(), + lastWayPoint(), waypointToAdd, - CurveType(curveType), + CurveType(curveType), ins->duration )); } @@ -532,7 +535,7 @@ void AutoNavigationHandler::addStopDetails(const Instruction* ins) { stopEntry.duration = ins->stopDuration; std::string anchorIdentifier = lastWayPoint().nodeDetails.identifier; - stopEntry.behavior = AtNodeNavigator::Behavior(_defaultStopBehavior.value()); + stopEntry.behavior = AtNodeNavigator::Behavior(_defaultStopBehavior.value()); if (ins->stopBehavior.has_value()) { std::string behaviorString = ins->stopBehavior.value(); @@ -544,8 +547,8 @@ void AutoNavigationHandler::addStopDetails(const Instruction* ins) { using Option = properties::OptionProperty::Option; std::vector