This commit is contained in:
Asuro
2025-02-11 01:56:28 +01:00
parent cace7b0ec0
commit 5bda220695
9 changed files with 87 additions and 26 deletions

View File

@@ -1,4 +1,6 @@
#include "Global.h"
#include "bx/constants.h"
#include "bx/math.h"
#include <cassert>
namespace
@@ -7,6 +9,31 @@ namespace
Game::GameInstance* GameInst = nullptr;
}
Quat Quat::FromEuler(float x, float y, float z)
{
x *= bx::kPi / 180.0f;
y *= bx::kPi / 180.0f;
z *= bx::kPi / 180.0f;
float cX = bx::cos(x);
float cY = bx::cos(y);
float cZ = bx::cos(z);
float sX = bx::sin(x);
float sY = bx::sin(y);
float sZ = bx::sin(z);
return Quat{
cX * cY * cZ - sX * sY * sZ,
sY * cX * cZ - sX * sZ * cY,
sX * sY * cZ + sZ * cX * cY,
sX * cY * cZ + sY * sZ * cX };
}
Quat Quat::FromEuler(Vec3 rot)
{
return Quat::FromEuler(rot.X, rot.Y, rot.Z);
}
namespace Game
{
SharedData& GetShared()