Struct Camera

Struct Documentation

struct Camera

Represents a camera with view and projection matrices for 3D rendering.

The Camera struct encapsulates the view and projection matrices used in 3D graphics. It provides constructors for initializing the camera with a view matrix, field of view, and aspect ratio, and offers access to the projection matrix.

Public Functions

Camera() = default
inline Camera(double fov, double aspectRatio)

Constructs a Camera object with the specified view matrix, field of view, and aspect ratio.

Initializes the camera’s view matrix and computes the projection matrix using a perspective projection.

Parameters:
  • viewMtx – The view matrix representing the camera’s orientation and position in the world.

  • fov – The field of view angle (in degrees) for the perspective projection.

  • aspectRatio – The aspect ratio (width divided by height) of the viewport.

inline void SetPosition(const glm::vec3 &position)
inline const glm::vec3 &GetPosition() const
inline const glm::vec3 &GetFront() const
inline const glm::vec3 &GetUp() const
inline void SetRotation(float yaw, float pitch)
inline float GetYaw() const
inline float GetPitch() const
inline const glm::mat4 &GetView() const
inline void SetAspectRatio(float aspectRatio)
inline float GetAspectRatio() const
inline void SetFov(float fov)
inline float GetFov() const
inline const glm::mat4 &GetProj() const