Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
CameraMovement::Utils Namespace Reference

Classes

class  ICameraBehavior
 Base interface for camera behaviors. More...
class  DefaultBehavior
 Default camera behavior with WASD movement and mouse look. More...
class  DontMoveBehavior
 Camera behavior that does not move the camera. More...

Functions

glm::quat ComputeLookAtQuaternion (const glm::vec3 &eye, const glm::vec3 &target, const glm::vec3 &up)
 Compute a quaternion that represents a "look at" rotation.
glm::quat RotateQuaternion (const glm::quat &current, float pitch, float yaw)
 Apply pitch and yaw rotation to a quaternion.
glm::vec3 GetRightVector (const glm::quat &rotation)
 Get the right vector from a quaternion rotation.
glm::vec3 GetUpVector (const glm::quat &rotation)
 Get the up vector from a quaternion rotation.
glm::vec3 GetForwardVector (const glm::quat &rotation)
 Get the forward vector from a quaternion rotation.

Function Documentation

◆ ComputeLookAtQuaternion()

glm::quat CameraMovement::Utils::ComputeLookAtQuaternion ( const glm::vec3 & eye,
const glm::vec3 & target,
const glm::vec3 & up )
inline

Compute a quaternion that represents a "look at" rotation.

Parameters
eyeThe position of the camera.
targetThe point the camera is looking at.
upThe up vector.
Returns
The quaternion representing the rotation.

◆ GetForwardVector()

glm::vec3 CameraMovement::Utils::GetForwardVector ( const glm::quat & rotation)
inline

Get the forward vector from a quaternion rotation.

Parameters
rotationThe rotation quaternion.
Returns
The forward vector.

◆ GetRightVector()

glm::vec3 CameraMovement::Utils::GetRightVector ( const glm::quat & rotation)
inline

Get the right vector from a quaternion rotation.

Parameters
rotationThe rotation quaternion.
Returns
The right vector.

◆ GetUpVector()

glm::vec3 CameraMovement::Utils::GetUpVector ( const glm::quat & rotation)
inline

Get the up vector from a quaternion rotation.

Parameters
rotationThe rotation quaternion.
Returns
The up vector.

◆ RotateQuaternion()

glm::quat CameraMovement::Utils::RotateQuaternion ( const glm::quat & current,
float pitch,
float yaw )
inline

Apply pitch and yaw rotation to a quaternion.

Parameters
currentThe current rotation quaternion.
pitchThe pitch angle in radians (rotation around right axis).
yawThe yaw angle in radians (rotation around up axis).
Returns
The new rotation quaternion.