From a1574aabd510d5fdc3842780b1d833aa2fb8eac6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 26 Feb 2019 22:31:15 -0500 Subject: common/quaternion: Move Quaternion into the Common namespace Quaternion is within the common library, so it should be using the Common namespace. --- src/input_common/motion_emu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/input_common/motion_emu.cpp') diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index 9570c060e..defb1a567 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp @@ -85,8 +85,8 @@ private: void MotionEmuThread() { auto update_time = std::chrono::steady_clock::now(); - Math::Quaternion q = MakeQuaternion(Math::Vec3(), 0); - Math::Quaternion old_q; + Common::Quaternion q = Common::MakeQuaternion(Math::Vec3(), 0); + Common::Quaternion old_q; while (!shutdown_event.WaitUntil(update_time)) { update_time += update_duration; @@ -96,8 +96,8 @@ private: std::lock_guard guard(tilt_mutex); // Find the quaternion describing current 3DS tilting - q = MakeQuaternion(Math::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x), - tilt_angle); + q = Common::MakeQuaternion(Math::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x), + tilt_angle); } auto inv_q = q.Inverse(); -- cgit v1.2.3 From 1b855efd5eb21ef802d15f6a531878754904ad4d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 26 Feb 2019 22:38:34 -0500 Subject: common/vector_math: Move Vec[x] types into the Common namespace These types are within the common library, so they should be using the Common namespace. --- src/input_common/motion_emu.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/input_common/motion_emu.cpp') diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index defb1a567..d5af05ee3 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp @@ -32,12 +32,12 @@ public: } void BeginTilt(int x, int y) { - mouse_origin = Math::MakeVec(x, y); + mouse_origin = Common::MakeVec(x, y); is_tilting = true; } void Tilt(int x, int y) { - auto mouse_move = Math::MakeVec(x, y) - mouse_origin; + auto mouse_move = Common::MakeVec(x, y) - mouse_origin; if (is_tilting) { std::lock_guard guard(tilt_mutex); if (mouse_move.x == 0 && mouse_move.y == 0) { @@ -56,7 +56,7 @@ public: is_tilting = false; } - std::tuple, Math::Vec3> GetStatus() { + std::tuple, Common::Vec3> GetStatus() { std::lock_guard guard(status_mutex); return status; } @@ -66,17 +66,17 @@ private: const std::chrono::steady_clock::duration update_duration; const float sensitivity; - Math::Vec2 mouse_origin; + Common::Vec2 mouse_origin; std::mutex tilt_mutex; - Math::Vec2 tilt_direction; + Common::Vec2 tilt_direction; float tilt_angle = 0; bool is_tilting = false; Common::Event shutdown_event; - std::tuple, Math::Vec3> status; + std::tuple, Common::Vec3> status; std::mutex status_mutex; // Note: always keep the thread declaration at the end so that other objects are initialized @@ -85,7 +85,7 @@ private: void MotionEmuThread() { auto update_time = std::chrono::steady_clock::now(); - Common::Quaternion q = Common::MakeQuaternion(Math::Vec3(), 0); + Common::Quaternion q = Common::MakeQuaternion(Common::Vec3(), 0); Common::Quaternion old_q; while (!shutdown_event.WaitUntil(update_time)) { @@ -96,14 +96,14 @@ private: std::lock_guard guard(tilt_mutex); // Find the quaternion describing current 3DS tilting - q = Common::MakeQuaternion(Math::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x), - tilt_angle); + q = Common::MakeQuaternion( + Common::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x), tilt_angle); } auto inv_q = q.Inverse(); // Set the gravity vector in world space - auto gravity = Math::MakeVec(0.0f, -1.0f, 0.0f); + auto gravity = Common::MakeVec(0.0f, -1.0f, 0.0f); // Find the angular rate vector in world space auto angular_rate = ((q - old_q) * inv_q).xyz * 2; @@ -131,7 +131,7 @@ public: device = std::make_shared(update_millisecond, sensitivity); } - std::tuple, Math::Vec3> GetStatus() const override { + std::tuple, Common::Vec3> GetStatus() const override { return device->GetStatus(); } -- cgit v1.2.3 From b9238edd0d0bfa7c88ad81ef00347b5194ebed77 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 26 Feb 2019 22:47:49 -0500 Subject: common/math_util: Move contents into the Common namespace These types are within the common library, so they should be within the Common namespace. --- src/input_common/motion_emu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/input_common/motion_emu.cpp') diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index d5af05ee3..6d96d4019 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp @@ -45,7 +45,7 @@ public: } else { tilt_direction = mouse_move.Cast(); tilt_angle = - std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f, MathUtil::PI * 0.5f); + std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f, Common::PI * 0.5f); } } } @@ -107,7 +107,7 @@ private: // Find the angular rate vector in world space auto angular_rate = ((q - old_q) * inv_q).xyz * 2; - angular_rate *= 1000 / update_millisecond / MathUtil::PI * 180; + angular_rate *= 1000 / update_millisecond / Common::PI * 180; // Transform the two vectors from world space to 3DS space gravity = QuaternionRotate(inv_q, gravity); -- cgit v1.2.3