diff --git a/include/openspace/interaction/camerainteractionstates.h b/include/openspace/interaction/camerainteractionstates.h index e619b1eaaf..6dc198e125 100644 --- a/include/openspace/interaction/camerainteractionstates.h +++ b/include/openspace/interaction/camerainteractionstates.h @@ -42,8 +42,6 @@ public: CameraInteractionStates(double sensitivity, double velocityScaleFactor); virtual ~CameraInteractionStates() = default; - virtual void updateStateFromInput(const InputState& inputState, double deltaTime) = 0; - void setRotationalFriction(double friction); void setHorizontalFriction(double friction); void setVerticalFriction(double friction); diff --git a/include/openspace/interaction/joystickcamerastates.h b/include/openspace/interaction/joystickcamerastates.h index f8f86f239b..ae0a3b0035 100644 --- a/include/openspace/interaction/joystickcamerastates.h +++ b/include/openspace/interaction/joystickcamerastates.h @@ -74,7 +74,8 @@ public: JoystickCameraStates(double sensitivity, double velocityScaleFactor); - void updateStateFromInput(const InputState& inputState, double deltaTime) override; + void updateStateFromInput( + const JoystickInputStates& joystickInputStates, double deltaTime); void setAxisMapping(int axis, AxisType mapping, AxisInvert shouldInvert = AxisInvert::No, diff --git a/include/openspace/interaction/mousecamerastates.h b/include/openspace/interaction/mousecamerastates.h index c1aae53864..f8a85b486a 100644 --- a/include/openspace/interaction/mousecamerastates.h +++ b/include/openspace/interaction/mousecamerastates.h @@ -33,7 +33,7 @@ class MouseCameraStates : public CameraInteractionStates { public: MouseCameraStates(double sensitivity, double velocityScaleFactor); - void updateStateFromInput(const InputState& inputState, double deltaTime) override; + void updateStateFromInput(const InputState& inputState, double deltaTime); void setInvertMouseButton(bool value); diff --git a/include/openspace/interaction/scriptcamerastates.h b/include/openspace/interaction/scriptcamerastates.h index df5fa5a612..41d06c8937 100644 --- a/include/openspace/interaction/scriptcamerastates.h +++ b/include/openspace/interaction/scriptcamerastates.h @@ -33,7 +33,7 @@ class ScriptCameraStates : public CameraInteractionStates { public: ScriptCameraStates(); - void updateStateFromInput(const InputState& inputState, double deltaTime) override; + void updateStateFromInput(double deltaTime); void addLocalRotation(const glm::dvec2& delta); void addGlobalRotation(const glm::dvec2& delta); diff --git a/include/openspace/interaction/websocketcamerastates.h b/include/openspace/interaction/websocketcamerastates.h index f36660a649..22b543ffc0 100644 --- a/include/openspace/interaction/websocketcamerastates.h +++ b/include/openspace/interaction/websocketcamerastates.h @@ -65,7 +65,8 @@ public: WebsocketCameraStates(double sensitivity, double velocityScaleFactor); - void updateStateFromInput(const InputState& inputState, double deltaTime) override; + void updateStateFromInput( + const WebsocketInputStates& websocketInputStates, double deltaTime); void setAxisMapping(int axis, AxisType mapping, AxisInvert shouldInvert = AxisInvert::No, diff --git a/src/interaction/joystickcamerastates.cpp b/src/interaction/joystickcamerastates.cpp index 91d89fe274..fd6a043046 100644 --- a/src/interaction/joystickcamerastates.cpp +++ b/src/interaction/joystickcamerastates.cpp @@ -37,7 +37,8 @@ JoystickCameraStates::JoystickCameraStates(double sensitivity, double velocitySc : CameraInteractionStates(sensitivity, velocityScaleFactor) {} -void JoystickCameraStates::updateStateFromInput(const InputState& inputState, +void JoystickCameraStates::updateStateFromInput( + const JoystickInputStates& joystickInputStates, double deltaTime) { std::pair globalRotation = { false, glm::dvec2(0.0) }; @@ -52,7 +53,7 @@ void JoystickCameraStates::updateStateFromInput(const InputState& inputState, continue; } - float rawValue = inputState.joystickAxis(i); + float rawValue = joystickInputStates.axis(i); float value = rawValue; if (t.isSticky) { diff --git a/src/interaction/scriptcamerastates.cpp b/src/interaction/scriptcamerastates.cpp index 863e630de3..fb05f1dc4c 100644 --- a/src/interaction/scriptcamerastates.cpp +++ b/src/interaction/scriptcamerastates.cpp @@ -30,7 +30,7 @@ namespace openspace::interaction { ScriptCameraStates::ScriptCameraStates() : CameraInteractionStates(1.0, 1.0) {} -void ScriptCameraStates::updateStateFromInput(const InputState&, double deltaTime) { +void ScriptCameraStates::updateStateFromInput(double deltaTime) { if (_localRotation != glm::dvec2(0.0)) { _localRotationState.velocity.set( _localRotation * _sensitivity, diff --git a/src/interaction/websocketcamerastates.cpp b/src/interaction/websocketcamerastates.cpp index eed4969513..4a219d4864 100644 --- a/src/interaction/websocketcamerastates.cpp +++ b/src/interaction/websocketcamerastates.cpp @@ -39,7 +39,8 @@ WebsocketCameraStates::WebsocketCameraStates(double sensitivity, : CameraInteractionStates(sensitivity, velocityScaleFactor) {} -void WebsocketCameraStates::updateStateFromInput(const InputState& inputState, +void WebsocketCameraStates::updateStateFromInput( + const WebsocketInputStates& websocketInputStates, double deltaTime) { std::pair globalRotation = { false, glm::dvec2(0.0) }; @@ -48,14 +49,14 @@ void WebsocketCameraStates::updateStateFromInput(const InputState& inputState, std::pair globalRoll = { false, glm::dvec2(0.0) }; std::pair localRotation = { false, glm::dvec2(0.0) }; - if (inputState.hasWebsocketStates()) { + if (!websocketInputStates.empty()) { for (int i = 0; i < WebsocketInputState::MaxAxes; ++i) { AxisInformation t = _axisMapping[i]; if (t.type == AxisType::None) { continue; } - float value = inputState.websocketAxis(i); + float value = websocketInputStates.axis(i); bool hasValue = std::fabs(value) > t.deadzone; if (!hasValue) { diff --git a/src/navigation/orbitalnavigator.cpp b/src/navigation/orbitalnavigator.cpp index fded5fca7f..70f52dcb2c 100644 --- a/src/navigation/orbitalnavigator.cpp +++ b/src/navigation/orbitalnavigator.cpp @@ -547,9 +547,9 @@ void OrbitalNavigator::updateStatesFromInput(const InputState& inputState, double deltaTime) { _mouseStates.updateStateFromInput(inputState, deltaTime); - _joystickStates.updateStateFromInput(inputState, deltaTime); - _websocketStates.updateStateFromInput(inputState, deltaTime); - _scriptStates.updateStateFromInput(inputState, deltaTime); + _joystickStates.updateStateFromInput(*global::joystickInputStates, deltaTime); + _websocketStates.updateStateFromInput(*global::websocketInputStates, deltaTime); + _scriptStates.updateStateFromInput(deltaTime); bool interactionHappened = _mouseStates.hasNonZeroVelocities() || _joystickStates.hasNonZeroVelocities() ||