mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
common/quaternion: Move Quaternion into the Common namespace
Quaternion is within the common library, so it should be using the Common namespace.
This commit is contained in:
parent
ad1cfc8d50
commit
db58652680
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "common/vector_math.h"
|
#include "common/vector_math.h"
|
||||||
|
|
||||||
namespace Math {
|
namespace Common {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Quaternion {
|
class Quaternion {
|
||||||
@ -46,4 +46,4 @@ inline Quaternion<float> MakeQuaternion(const Math::Vec3<float>& axis, float ang
|
|||||||
return {axis * std::sin(angle / 2), std::cos(angle / 2)};
|
return {axis * std::sin(angle / 2), std::cos(angle / 2)};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Math
|
} // namespace Common
|
||||||
|
@ -87,8 +87,8 @@ private:
|
|||||||
|
|
||||||
void MotionEmuThread() {
|
void MotionEmuThread() {
|
||||||
auto update_time = std::chrono::steady_clock::now();
|
auto update_time = std::chrono::steady_clock::now();
|
||||||
Math::Quaternion<float> q = MakeQuaternion(Math::Vec3<float>(), 0);
|
Common::Quaternion<float> q = Common::MakeQuaternion(Math::Vec3<float>(), 0);
|
||||||
Math::Quaternion<float> old_q;
|
Common::Quaternion<float> old_q;
|
||||||
|
|
||||||
while (!shutdown_event.WaitUntil(update_time)) {
|
while (!shutdown_event.WaitUntil(update_time)) {
|
||||||
update_time += update_duration;
|
update_time += update_duration;
|
||||||
@ -98,8 +98,8 @@ private:
|
|||||||
std::lock_guard<std::mutex> guard(tilt_mutex);
|
std::lock_guard<std::mutex> guard(tilt_mutex);
|
||||||
|
|
||||||
// Find the quaternion describing current 3DS tilting
|
// Find the quaternion describing current 3DS tilting
|
||||||
q = MakeQuaternion(Math::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x),
|
q = Common::MakeQuaternion(Math::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x),
|
||||||
tilt_angle);
|
tilt_angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto inv_q = q.Inverse();
|
auto inv_q = q.Inverse();
|
||||||
|
Loading…
Reference in New Issue
Block a user