summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
diff options
context:
space:
mode:
authorLC <mathew1800@gmail.com>2020-10-21 17:34:11 -0400
committerGitHub <noreply@github.com>2020-10-21 17:34:11 -0400
commitde96fe08600bb75ac2fc5d1c641ab34b8406d91b (patch)
tree25f997cd0f63a463852fcf97005acdfd6c939505 /Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
parente553197c67f7c91d73d6c1195a58d522ab97c39f (diff)
parent907fdd26fc46bdf3027c2075364e5281b6c6badc (diff)
Merge pull request #9162 from jordan-woyak/quaternion
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.cpp12
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 842856d82e..a946059cab 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);