Revert "code: Use std::numbers::pi"

* Not available on Android

This reverts commit d6e545932a.
This commit is contained in:
GPUCode
2022-11-03 14:01:24 +02:00
parent 0f0ca03551
commit 407ae3972a
3 changed files with 9 additions and 5 deletions

View File

@@ -10,6 +10,8 @@
namespace Common {
constexpr float PI = 3.14159265f;
template <class T>
struct Rectangle {
T left{};

View File

@@ -47,7 +47,7 @@ public:
} else {
tilt_direction = mouse_move.Cast<float>();
tilt_angle = std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f,
std::numbers::pi_v<float> * this->tilt_clamp / 180.0f);
Common::PI * this->tilt_clamp / 180.0f);
}
}
}
@@ -110,7 +110,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 / std::numbers::pi_v<float> * 180;
angular_rate *= 1000 / update_millisecond / Common::PI * 180;
// Transform the two vectors from world space to 3DS space
gravity = QuaternionRotate(inv_q, gravity);

View File

@@ -16,6 +16,8 @@
#include <utility>
#include <vector>
#include <SDL.h>
#include "common/assert.h"
#include "common/math_util.h"
#include "common/logging/log.h"
#include "common/param_package.h"
#include "common/threadsafe_queue.h"
@@ -596,9 +598,9 @@ void SDLState::HandleGameControllerEvent(const SDL_Event& event) {
event.csensor.data[2] / SDL_STANDARD_GRAVITY);
break;
case SDL_SENSOR_GYRO:
joystick->SetGyro(-event.csensor.data[0] * (180.0f / std::numbers::pi),
event.csensor.data[1] * (180.0f / std::numbers::pi),
-event.csensor.data[2] * (180.0f / std::numbers::pi));
joystick->SetGyro(-event.csensor.data[0] * (180.0f / Common::PI),
event.csensor.data[1] * (180.0f / Common::PI),
-event.csensor.data[2] * (180.0f / Common::PI));
break;
}
}