12#ifndef CSCI441_PERSPECTIVE_CAMERA_HPP
13#define CSCI441_PERSPECTIVE_CAMERA_HPP
32 explicit PerspectiveCamera(GLfloat aspectRatio = 1.0f, GLfloat fovy = 45.0f, GLfloat nearClipPlane = 0.001f, GLfloat farClipPlane = 1000.0f);
44 [[maybe_unused]]
virtual void setAspectRatio(GLfloat aspectRatio)
final;
102 GLfloat _aspectRatio;
106 GLfloat _nearClipPlane;
110 GLfloat _farClipPlane;
116 const GLfloat aspectRatio,
118 const GLfloat nearClipPlane,
119 const GLfloat farClipPlane
121 _aspectRatio(aspectRatio),
122 _nearClipPlane(nearClipPlane),
123 _farClipPlane(farClipPlane)
130 _aspectRatio = aspectRatio;
131 mUpdateProjectionMatrix();
137 mUpdateProjectionMatrix();
142 _nearClipPlane = near;
143 mUpdateProjectionMatrix();
149 mUpdateProjectionMatrix();
153 mProjectionMatrix = glm::perspective(_fovy, _aspectRatio, _nearClipPlane, _farClipPlane);
Abstract Camera class to be placed (position and orientation) within our scene.
Abstract Class to represent a synthetic camera. The following methods must be overridden:
Definition: Camera.hpp:39
Abstract Class to represent a perspective camera. Stores aspect ratio and field of view.
Definition: PerspectiveCamera.hpp:22
PerspectiveCamera(const PerspectiveCamera &)=default
construct a copy an existing camera
void mUpdateProjectionMatrix()
computes the perspective projection matrix for the camera
Definition: PerspectiveCamera.hpp:152
PerspectiveCamera & operator=(const PerspectiveCamera &)=default
assign a copy of an existing camera
virtual void setNearClipPlane(GLfloat near) final
updates the camera's near clip plane
Definition: PerspectiveCamera.hpp:141
PerspectiveCamera(PerspectiveCamera &&)=default
construct a camera by moving ane existing camera object
virtual void setFarClipPlane(GLfloat far) final
updates the camera's far clip plane
Definition: PerspectiveCamera.hpp:147
virtual void setAspectRatio(GLfloat aspectRatio) final
updates the camera's aspect ratio
Definition: PerspectiveCamera.hpp:129
~PerspectiveCamera() override=default
properly destroy concrete children
PerspectiveCamera & operator=(PerspectiveCamera &&)=default
reassign an existing camera to ourselves
PerspectiveCamera(GLfloat aspectRatio=1.0f, GLfloat fovy=45.0f, GLfloat nearClipPlane=0.001f, GLfloat farClipPlane=1000.0f)
initializes the Perspective Camera
Definition: PerspectiveCamera.hpp:115
virtual void setVerticalFOV(GLfloat fovy) final
updates the camera's vertical field of view
Definition: PerspectiveCamera.hpp:135
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17