1#ifndef CSCI441_PERSPECTIVE_CAMERA_HPP
2#define CSCI441_PERSPECTIVE_CAMERA_HPP
21 explicit PerspectiveCamera(GLfloat aspectRatio = 1.0f, GLfloat fovy = 45.0f, GLfloat nearClipPlane = 0.001f, GLfloat farClipPlane = 1000.0f);
33 [[maybe_unused]]
virtual void setAspectRatio(GLfloat aspectRatio)
final;
95 GLfloat _nearClipPlane;
99 GLfloat _farClipPlane;
105 const GLfloat aspectRatio,
107 const GLfloat nearClipPlane,
108 const GLfloat farClipPlane
110 _aspectRatio(aspectRatio),
111 _nearClipPlane(nearClipPlane),
112 _farClipPlane(farClipPlane)
119 _aspectRatio = aspectRatio;
120 mUpdateProjectionMatrix();
126 mUpdateProjectionMatrix();
131 _nearClipPlane = near;
132 mUpdateProjectionMatrix();
138 mUpdateProjectionMatrix();
142 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:37
Abstract Class to represent a perspective camera. Stores aspect ratio and field of view.
Definition: PerspectiveCamera.hpp:11
PerspectiveCamera(const PerspectiveCamera &)=default
construct a copy an existing camera
void mUpdateProjectionMatrix()
computes the perspective projection matrix for the camera
Definition: PerspectiveCamera.hpp:141
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:130
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:136
virtual void setAspectRatio(GLfloat aspectRatio) final
updates the camera's aspect ratio
Definition: PerspectiveCamera.hpp:118
~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:104
virtual void setVerticalFOV(GLfloat fovy) final
updates the camera's vertical field of view
Definition: PerspectiveCamera.hpp:124
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17