Files
FGL-Engine/src/engine/primitives/rotation/QuatRotation.hpp

71 lines
1.5 KiB
C++

//
// Created by kj16609 on 2/17/24.
//
#pragma once
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wduplicated-branches"
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/fwd.hpp>
#include <glm/gtx/quaternion.hpp>
#pragma GCC diagnostic pop
#include "engine/primitives/matricies/RotationMatrix.hpp"
#include "engine/primitives/vectors/NormalVector.hpp"
namespace fgl::engine
{
struct QuatRotation;
}
namespace fgl::engine
{
struct QuatRotation : private glm::quat
{
QuatRotation();
QuatRotation( float x, float y, float z );
QuatRotation( float value );
QuatRotation( const glm::quat& quat ) : glm::quat( quat ) {}
RotationMatrix mat() const { return { glm::toMat3( *this ) }; }
NormalVector forward() const;
NormalVector right() const;
NormalVector up() const;
void setX( float );
void setY( float );
void setZ( float );
// These will add a rotation using the local axis
void addX( float );
void addY( float );
void addZ( float );
// These will add a rotation using the world axis
void addXWorld( float );
void addYWorld( float );
void addZWorld( float );
// internal
glm::quat internal_quat() const;
bool operator==( const QuatRotation& rot ) const;
friend bool operator==( const QuatRotation&, const glm::quat& );
};
bool operator==( const QuatRotation& rot, const glm::quat& quat );
namespace constants
{
constexpr glm::vec3 DEFAULT_ROTATION { 0.0f, 0.0f, 0.0f };
}
} // namespace fgl::engine