diff --git a/include/openspace/interaction/orbitalnavigator.h b/include/openspace/interaction/orbitalnavigator.h index 3fdbfa76a8..e541ab23fd 100644 --- a/include/openspace/interaction/orbitalnavigator.h +++ b/include/openspace/interaction/orbitalnavigator.h @@ -65,8 +65,8 @@ public: void setCamera(Camera* camera); void clearPreviousState(); - SceneGraphNode* focusNode() const; - void setFocusNode(const SceneGraphNode* focusNode, bool resetVelocitiesOnChange = true); + void setFocusNode(const SceneGraphNode* focusNode, + bool resetVelocitiesOnChange = true); void setFocusNode(const std::string& focusNode, bool resetVelocitiesOnChange = true); void setAnchorNode(const std::string& anchorNode); void setAimNode(const std::string& aimNode); @@ -121,7 +121,8 @@ private: properties::FloatProperty friction; }; - void setAnchorNode(const SceneGraphNode* anchorNode, bool resetVelocitiesOnChange = true); + void setAnchorNode(const SceneGraphNode* anchorNode, + bool resetVelocitiesOnChange = true); void setAimNode(const SceneGraphNode* aimNode); Camera* _camera; diff --git a/modules/server/src/topics/flightcontrollertopic.cpp b/modules/server/src/topics/flightcontrollertopic.cpp index fc6c5a29fe..3e2289c5a5 100644 --- a/modules/server/src/topics/flightcontrollertopic.cpp +++ b/modules/server/src/topics/flightcontrollertopic.cpp @@ -309,9 +309,9 @@ void FlightControllerTopic::changeFocus(const nlohmann::json& json) const { ); if (json.find(AnchorKey) == json.end()) { const std::string j = json; - LWARNING( - fmt::format("Could not find {} key in JSON. JSON was:\n{}", AnchorKey, j) - ); + LWARNING(fmt::format( + "Could not find {} key in JSON. JSON was:\n{}", AnchorKey, j + )); return; } } @@ -325,11 +325,15 @@ void FlightControllerTopic::changeFocus(const nlohmann::json& json) const { const bool retargetAnchor = json[RetargetAnchorKey]; const bool retargetAim = json[RetargetAimKey]; - const SceneGraphNode* focusNode = global::renderEngine.scene()->sceneGraphNode(focus); - const SceneGraphNode* aimNode = global::renderEngine.scene()->sceneGraphNode(aim); - const SceneGraphNode* anchorNode = global::renderEngine.scene()->sceneGraphNode(anchor); + Scene* scene = global::renderEngine.scene(); + const SceneGraphNode* focusNode = scene->sceneGraphNode(focus); + const SceneGraphNode* aimNode = scene->sceneGraphNode(aim); + const SceneGraphNode* anchorNode = scene->sceneGraphNode(anchor); if (focusNode) { - global::navigationHandler.orbitalNavigator().setFocusNode(focusNode, resetVelocities); + global::navigationHandler.orbitalNavigator().setFocusNode( + focusNode, + resetVelocities + ); } else { if (aimNode) { diff --git a/src/interaction/orbitalnavigator.cpp b/src/interaction/orbitalnavigator.cpp index b767d7c662..4268b5c180 100644 --- a/src/interaction/orbitalnavigator.cpp +++ b/src/interaction/orbitalnavigator.cpp @@ -659,17 +659,21 @@ glm::dvec3 OrbitalNavigator::cameraToSurfaceVector(const glm::dvec3& cameraPos, return centerToActualSurface - posDiff; } -void OrbitalNavigator::setFocusNode(const SceneGraphNode* focusNode, bool resetVelocitiesOnChange) { +void OrbitalNavigator::setFocusNode(const SceneGraphNode* focusNode, + bool resetVelocitiesOnChange) +{ setAnchorNode(focusNode, resetVelocitiesOnChange); setAimNode(nullptr); } -void OrbitalNavigator::setFocusNode(const std::string& focusNode, bool resetVelocitiesOnChange) { +void OrbitalNavigator::setFocusNode(const std::string& focusNode, bool) { _anchor.set(focusNode); _aim.set(std::string("")); } -void OrbitalNavigator::setAnchorNode(const SceneGraphNode* anchorNode, bool resetVelocitiesOnChange) { +void OrbitalNavigator::setAnchorNode(const SceneGraphNode* anchorNode, + bool resetVelocitiesOnChange) +{ if (!_anchorNode) { _directlySetStereoDistance = true; }