diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-10-19 15:29:16 -0500 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-10-19 16:33:55 -0500 |
| commit | 09431635f34ebca9975e329db7d972fc6f91756f (patch) | |
| tree | 42d7f098b7e7887fc602263cc1817f8df638cba4 /Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp | |
| parent | 39030ea33c3521c68abfd24b5466a1789541a00c (diff) | |
InputCommon/WiimoteEmu: Replace stateful rotational matrices with quaternions.
Diffstat (limited to 'Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp index eb56434bd1..c55c28f975 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp @@ -579,7 +579,7 @@ void AccelerometerMappingIndicator::Draw() // UI axes are opposite that of Wii remote accelerometer. p.scale(-1.0, -1.0); - const auto rotation = WiimoteEmu::GetMatrixFromAcceleration(state); + const auto rotation = WiimoteEmu::GetRotationFromAcceleration(state); // Draw sphere. p.setPen(GetCosmeticPen(QPen(GetRawInputColor(), 0.5))); @@ -650,8 +650,9 @@ void GyroMappingIndicator::Draw() const auto jitter = raw_gyro_state - m_previous_velocity; m_previous_velocity = raw_gyro_state; - m_state *= WiimoteEmu::GetMatrixFromGyroscope(angular_velocity * Common::Vec3(-1, +1, -1) / - INDICATOR_UPDATE_FREQ); + m_state *= WiimoteEmu::GetRotationFromGyroscope(angular_velocity * Common::Vec3(-1, +1, -1) / + INDICATOR_UPDATE_FREQ); + m_state = m_state.Normalized(); // Reset orientation when stable for a bit: constexpr u32 STABLE_RESET_STEPS = INDICATOR_UPDATE_FREQ; @@ -664,10 +665,11 @@ void GyroMappingIndicator::Draw() ++m_stable_steps; if (STABLE_RESET_STEPS == m_stable_steps) - m_state = Common::Matrix33::Identity(); + m_state = Common::Quaternion::Identity(); // Use an empty rotation matrix if gyroscope data is not present. - const auto rotation = (gyro_state.has_value() ? m_state : Common::Matrix33{}); + const auto rotation = + (gyro_state.has_value() ? Common::Matrix33::FromQuaternion(m_state) : Common::Matrix33{}); QPainter p(this); DrawBoundingBox(p); |
