12#ifndef CSCI441_PERSPECTIVE_CAMERA_HPP
13#define CSCI441_PERSPECTIVE_CAMERA_HPP
32 explicit PerspectiveCamera(GLfloat aspectRatio = 1.0f, GLfloat fovy = glm::quarter_pi<GLfloat>(), GLfloat nearClipPlane = 0.001f, GLfloat farClipPlane = 1000.0f);
44 [[maybe_unused]]
virtual void setAspectRatio(GLfloat aspectRatio)
final;
103 GLfloat _aspectRatio;
107 GLfloat _nearClipPlane;
111 GLfloat _farClipPlane;
117 const GLfloat aspectRatio,
119 const GLfloat nearClipPlane,
120 const GLfloat farClipPlane
122 _aspectRatio(aspectRatio),
123 _nearClipPlane(nearClipPlane),
124 _farClipPlane(farClipPlane)
131 _aspectRatio = aspectRatio;
132 mUpdateProjectionMatrix();
138 mUpdateProjectionMatrix();
143 _nearClipPlane = near;
144 mUpdateProjectionMatrix();
150 mUpdateProjectionMatrix();
154 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:153
PerspectiveCamera & operator=(const PerspectiveCamera &)=default
assign a copy of an existing camera
PerspectiveCamera(GLfloat aspectRatio=1.0f, GLfloat fovy=glm::quarter_pi< GLfloat >(), GLfloat nearClipPlane=0.001f, GLfloat farClipPlane=1000.0f)
initializes the Perspective Camera
Definition: PerspectiveCamera.hpp:116
virtual void setNearClipPlane(GLfloat near) final
updates the camera's near clip plane
Definition: PerspectiveCamera.hpp:142
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:148
virtual void setAspectRatio(GLfloat aspectRatio) final
updates the camera's aspect ratio
Definition: PerspectiveCamera.hpp:130
~PerspectiveCamera() override=default
properly destroy concrete children
PerspectiveCamera & operator=(PerspectiveCamera &&)=default
reassign an existing camera to ourselves
virtual void setVerticalFOV(GLfloat fovy) final
updates the camera's vertical field of view
Definition: PerspectiveCamera.hpp:136
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17