Somewhat working camera

This commit is contained in:
Dynamitos
2022-03-19 22:45:30 +01:00
parent 84049a762c
commit cd28e433cc
41 changed files with 602 additions and 496 deletions
-24
View File
@@ -64,30 +64,6 @@ static inline float normalizeRotatorAxis(float angle)
return angle;
}
static inline Quaternion toQuaternion(const Vector &other)
{
Quaternion result;
const float DEG_TO_RAD = glm::pi<float>() / (180.f);
const float RADS_DIVIDED_BY_2 = DEG_TO_RAD / 2.f;
const float PitchNoWinding = fmod(other.x, 360.0f);
const float YawNoWinding = fmod(other.y, 360.0f);
const float RollNoWinding = fmod(other.z, 360.0f);
const float SP = sin(PitchNoWinding * RADS_DIVIDED_BY_2);
const float SY = sin(YawNoWinding * RADS_DIVIDED_BY_2);
const float SR = sin(RollNoWinding * RADS_DIVIDED_BY_2);
const float CP = cos(PitchNoWinding * RADS_DIVIDED_BY_2);
const float CY = cos(YawNoWinding * RADS_DIVIDED_BY_2);
const float CR = cos(RollNoWinding * RADS_DIVIDED_BY_2);
result.x = CR * SP * SY - SR * CP * CY;
result.y = -CR * SP * CY - SR * CP * SY;
result.z = CR * CP * SY - SR * SP * CY;
result.w = CR * CP * CY + SR * SP * SY;
return result;
}
static inline Vector toRotator(const Quaternion &other)
{