1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-01 07:13:22 +00:00

Use M_PI as osg::PIf is not constant

This commit is contained in:
Sam Hellawell 2024-05-18 06:38:41 +01:00
parent 1317434ac0
commit 5deacb82ff

View File

@ -4,7 +4,10 @@
#include <osgAnimation/Bone> #include <osgAnimation/Bone>
#define _USE_MATH_DEFINES
#include <cassert> #include <cassert>
#include <cmath>
#include <string> #include <string>
#include <vector> #include <vector>
@ -22,17 +25,17 @@ namespace MWRender
float sineOut(float x) float sineOut(float x)
{ {
return sin((x * osg::PIf) / 2); return sin((x * M_PI) / 2);
} }
float sineIn(float x) float sineIn(float x)
{ {
return 1 - cos((x * osg::PIf) / 2); return 1 - cos((x * M_PI) / 2);
} }
float sineInOut(float x) float sineInOut(float x)
{ {
return -(cos(osg::PIf * x) - 1) / 2; return -(cos(M_PI * x) - 1) / 2;
} }
float cubicOut(float t) float cubicOut(float t)
@ -87,7 +90,7 @@ namespace MWRender
{ {
// Higher lambda = lower swing amplitude. 1 = 150% swing amplitude. // Higher lambda = lower swing amplitude. 1 = 150% swing amplitude.
// w is the frequency of oscillation in the easing func, controls the amount of overswing // w is the frequency of oscillation in the easing func, controls the amount of overswing
constexpr float w = 1.5f * osg::PIf; // 4.71238 constexpr float w = 1.5f * M_PI; // 4.71238
return 1 - expf(-lambda * x) * cos(w * x); return 1 - expf(-lambda * x) * cos(w * x);
} }