diff options
| author | 2023-02-21 21:47:47 -0600 | |
|---|---|---|
| committer | 2023-02-21 21:55:23 -0600 | |
| commit | 739a81055f8f33ab0987ee730370a0535a1bdf05 (patch) | |
| tree | 8d7acb47d0b2915112f13aaa9542368cf8c5b8ce /src/core/hid/motion_input.h | |
| parent | input_common: Implement dedicated motion from mouse (diff) | |
| download | yuzu-739a81055f8f33ab0987ee730370a0535a1bdf05.tar.gz yuzu-739a81055f8f33ab0987ee730370a0535a1bdf05.tar.xz yuzu-739a81055f8f33ab0987ee730370a0535a1bdf05.zip | |
core: hid: Restore motion state on refresh and clamp motion values
Diffstat (limited to 'src/core/hid/motion_input.h')
| -rw-r--r-- | src/core/hid/motion_input.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/hid/motion_input.h b/src/core/hid/motion_input.h index 9180bb9aa..e2c1bbf95 100644 --- a/src/core/hid/motion_input.h +++ b/src/core/hid/motion_input.h | |||
| @@ -20,6 +20,9 @@ public: | |||
| 20 | static constexpr float IsAtRestStandard = 0.01f; | 20 | static constexpr float IsAtRestStandard = 0.01f; |
| 21 | static constexpr float IsAtRestThight = 0.005f; | 21 | static constexpr float IsAtRestThight = 0.005f; |
| 22 | 22 | ||
| 23 | static constexpr float GyroMaxValue = 5.0f; | ||
| 24 | static constexpr float AccelMaxValue = 7.0f; | ||
| 25 | |||
| 23 | explicit MotionInput(); | 26 | explicit MotionInput(); |
| 24 | 27 | ||
| 25 | MotionInput(const MotionInput&) = default; | 28 | MotionInput(const MotionInput&) = default; |
| @@ -40,6 +43,7 @@ public: | |||
| 40 | 43 | ||
| 41 | void EnableReset(bool reset); | 44 | void EnableReset(bool reset); |
| 42 | void ResetRotations(); | 45 | void ResetRotations(); |
| 46 | void ResetQuaternion(); | ||
| 43 | 47 | ||
| 44 | void UpdateRotation(u64 elapsed_time); | 48 | void UpdateRotation(u64 elapsed_time); |
| 45 | void UpdateOrientation(u64 elapsed_time); | 49 | void UpdateOrientation(u64 elapsed_time); |
| @@ -69,7 +73,7 @@ private: | |||
| 69 | Common::Vec3f derivative_error; | 73 | Common::Vec3f derivative_error; |
| 70 | 74 | ||
| 71 | // Quaternion containing the device orientation | 75 | // Quaternion containing the device orientation |
| 72 | Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f}; | 76 | Common::Quaternion<f32> quat; |
| 73 | 77 | ||
| 74 | // Number of full rotations in each axis | 78 | // Number of full rotations in each axis |
| 75 | Common::Vec3f rotations; | 79 | Common::Vec3f rotations; |