Small coding style fixes

This commit is contained in:
Alexander Bock
2020-08-17 22:50:27 +02:00
parent edb7d9ba1d
commit a6d8d0e735
3 changed files with 22 additions and 13 deletions
@@ -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;
@@ -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) {
+7 -3
View File
@@ -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;
}