Class Camera

Inheritance Relationships

Derived Types

Class Documentation

class Camera

Subclassed by Azura::FlyThroughCamera, Azura::PolarCamera

Public Functions

Camera(U32 width, U32 height)

Constructs the camera with the given width and height.

The height & width provided are used in the projection matrix computation.

Parameters
  • width: The film width
  • height: The film height

virtual ~Camera()
Camera(const Camera &other)
Camera(Camera &&other)
Camera &operator=(const Camera &other)
Camera &operator=(Camera &&other)
void SetSensitivity(float value)

Sets the sensitivity of the camera.

Sensitivity is an independent parameter and may be used by the dervied class in a particular way.

Parameters
  • value: The sensitivity value

float GetSensitivity() const

Query the sensitivity of the camera.

Return
The sensitivity of the camera.

void SetNearClip(float value)

Sets the near clip plane for the camera.

Parameters
  • value: The value

void SetFarClip(float value)

Sets the far clip plane for the camera.

Parameters
  • value: The value

float GetNearClip() const

Query the near clip plane value of the camera.

Return
The near clip value.

float GetFarClip() const

Query the far clip plane value of the camera.

Return
The far clip value.

void SetFOVY(float value)

Sets the vertical field of view of the camera.

Parameters
  • value: The value

void SetPosition(Vector3f value)

Sets the camera position.

Parameters
  • value: 3D world position

void SetReferencePoint(Vector3f value)

Sets the reference point for the camera.

The reference point is the camera’s target.

Parameters
  • value: 3D world position

Vector3f GetPosition() const

Query to get the current camera position.

Return
The position.

Matrix4f GetViewProjMatrix() const

Gets the view projection matrix for the camera.

Return
The view projection matrix.

Matrix4f GetInvViewProjMatrix() const

Gets the inverse of the view projection matrix for the camera.

Return
The inverse of view projection matrix.

Matrix4f GetViewMatrix() const

Gets the view matrix.

Return
The view matrix.

Matrix4f GetProjMatrix() const

Gets the projection matrix.

Return
The projection matrix.

virtual void Recompute() = 0

Tells the camera to update its matrices & other properties.

Cameras in Azura don’t recompute always. For example, you maybe wanted to move the camera first, then rotate it, maybe then shift it due to some physics. At the end, One can call recompute only once to get the final view projection matrix.

Recompute will compute the view & projection matrices (and their combinations).

virtual void Update(float timeDelta) = 0

Update based on Window events.

Azura cameras have the ability to listen to keyboard events or mouse events. They can then perform movements based on the timeDelta passed. This is highly useful as every PolarCamera or FlyThroughCamera are generally the same with some modification for the screen, fovy etc.

They all respond to a basic set of movements. However, the user can modify the keyboard keys for each camera. But this is highly dependent on the application using the camera. For example, WASD is the default for all cameras. But one can change those keys to maybe say the arrow keys.

Parameters
  • timeDelta: The time delta

virtual void OnMouseEvent(MouseEvent mouseEvent) = 0
virtual void OnKeyEvent(KeyEvent keyEvent) = 0

Protected Attributes

U32 m_width
U32 m_height
float m_aspect
float m_sensitivity = {0.5f}
float m_nearClip = {0.0001f}
float m_farClip = {1000.0f}
float m_fovY = {45.0f}
Vector3f m_eye = {0, 0, 0}
Vector3f m_ref = {0, 0, 0}
Matrix4f m_view
Matrix4f m_proj
Matrix4f m_viewProj
Matrix4f m_invViewProj