Class Camera

Inheritance Relationships

Derived Types

Class Documentation

class Camera

Base camera type.

Note

Abstract, so cannot be passed by value

Subclassed by Cacao::OrthographicCamera, Cacao::PerspectiveCamera

Public Functions

Camera()

Create a camera.

inline virtual ~Camera()

Destroy a camera.

inline glm::vec3 GetPosition() const

Get the position of the camera.

Returns:

The camera position in world space

inline void SetPosition(glm::vec3 pos)

Set the position of the camera.

Parameters:

pos – The new position

inline glm::quat GetRotation() const

Get the rotation of the camera.

Returns:

The rotation

inline glm::vec3 GetRotationEuler() const

Get the rotation of the camera as Euler angles in degrees.

Returns:

The rotation as Euler angles

inline void SetRotation(glm::quat rot)

Set the rotation of the camera.

Parameters:

rot – The new rotation

inline void SetRotationEuler(glm::vec3 rot)

Set the rotation of the camera using Euler angles in degrees.

Parameters:

rot – The new rotation in Euler angles

inline glm::mat4 GetProjectionMatrix() const

Get the projection matrix.

Returns:

The projection matrix

inline glm::mat4 GetViewMatrix() const

Get the view matrix.

Returns:

The view matrix

inline glm::vec3 GetFrontVector() const

Get the camera’s front vector.

Returns:

The unit vector pointing out at the camera’s rotation

inline glm::vec3 GetRightVector() const

Get the camera’s up vector.

Returns:

The unit vector perpendicular to both the front and world up vectors

inline glm::vec3 GetUpVector() const

Get the camera’s up vector.

Returns:

The unit vector perpendicular to both the front and right vectors

inline glm::vec3 GetLookTarget() const

Get the point in world space where the camera is looking.

Returns:

The look target (which is the position + the front vector)

inline glm::u8vec3 GetClearColor() const

Get the clear color used by the camera.

Returns:

The camera clear color (in hexadecimal 00 to FF per component)

inline void SetClearColor(glm::u8vec3 color)

Set the camera’s clear color.

Parameters:

color – The new clear color (in hexadecimal 00 to FF per component)

void ResizeProjectionMatrix(Event &e)

Event handler for resizing the projection matrix when the window size changes.

Note

For use only by the engine internally

Parameters:

e – The event object (which will be casted to a DataEvent<glm::uvec2>)

Protected Functions

void RecalculateViewMatrix()
virtual void RecalculateProjectionMatrix() = 0
void RecalculateCameraVectors()

Protected Attributes

EventConsumer resizeConsumer
glm::u8vec3 clearColor
glm::mat4 projectionMatrix
glm::mat4 viewMatrix
glm::mat4 viewProjectionMatrix
glm::vec3 position
glm::quat rotation
glm::vec3 frontVec
glm::vec3 upVec
glm::vec3 rightVec
glm::uvec2 displaySize