Class PerspectiveCamera

Inheritance Relationships

Base Type

Class Documentation

class PerspectiveCamera : public Cacao::Camera

Camera implementing a perspective view.

Public Functions

PerspectiveCamera(float fov = 60)

Create a perspective camera.

Parameters:

fov – The FOV in degrees

Throws:

BadInitStateException – If the window is not open

inline virtual glm::vec3 GetPosition() const override

Get the position of the camera.

Returns:

The camera position in world space

inline virtual void SetPosition(glm::vec3 pos) override

Set the position of the camera.

Parameters:

pos – The new position

inline virtual glm::vec3 GetRotation() const override

Get the rotation of the camera.

Returns:

The camera rotation

inline virtual void SetRotation(glm::vec3 rot) override

Set the rotation of the camera.

Parameters:

rot – The new rotation

inline float GetFOV() const

Get the camera’s FOV.

Returns:

The FOV

inline void SetFOV(float newFov)

Set the camera’s FOV.

Parameters:

newFov – The new FOV in degrees

inline virtual glm::mat4 GetProjectionMatrix() const override

Get the projection matrix.

Returns:

The projection matrix

inline virtual glm::mat4 GetViewMatrix() const override

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)

virtual void ResizeProjectionMatrix(Event &e) override

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

Note

For use by the engine only

Parameters:

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