12#ifndef CSCI441_FREE_CAM_HPP
13#define CSCI441_FREE_CAM_HPP
15#include "PerspectiveCamera.hpp"
33 explicit FreeCam(GLfloat aspectRatio = 1.0f, GLfloat fovy = 45.0f, GLfloat nearClipPlane = 0.001f, GLfloat farClipPlane = 1000.0f);
85 void _updateFreeCameraViewMatrix();
90 const GLfloat aspectRatio,
92 const GLfloat nearClipPlane,
93 const GLfloat farClipPlane
101 mCameraDirection.x = glm::sin(mCameraTheta ) * glm::sin(mCameraPhi );
102 mCameraDirection.y = -glm::cos(mCameraPhi );
103 mCameraDirection.z = -glm::cos(mCameraTheta ) * glm::sin(mCameraPhi );
106 mCameraDirection = glm::normalize(mCameraDirection );
108 _updateFreeCameraViewMatrix();
112 mCameraPosition += mCameraDirection * movementFactor;
113 _updateFreeCameraViewMatrix();
117 mCameraPosition -= mCameraDirection * movementFactor;
118 _updateFreeCameraViewMatrix();
121inline void CSCI441::FreeCam::_updateFreeCameraViewMatrix() {
122 setLookAtPoint(mCameraPosition + mCameraDirection );
A camera that implements a FreeCam camera model.
Definition: FreeCam.hpp:23
FreeCam(GLfloat aspectRatio=1.0f, GLfloat fovy=45.0f, GLfloat nearClipPlane=0.001f, GLfloat farClipPlane=1000.0f)
Definition: FreeCam.hpp:89
void recomputeOrientation() override
converts spherical theta & phi to cartesian x,y,z direction vector
Definition: FreeCam.hpp:99
~FreeCam() override=default
properly destroy concrete children
FreeCam(FreeCam &&)=default
construct a camera by moving ane existing camera object
FreeCam & operator=(const FreeCam &)=default
assign a copy of an existing camera
void moveBackward(GLfloat movementFactor) override
updates the camera's position by the adding the camera's negative direction to the camera's position
Definition: FreeCam.hpp:116
void moveForward(GLfloat movementFactor) override
updates the camera's position by the adding the camera's direction to the camera's position
Definition: FreeCam.hpp:111
FreeCam(const FreeCam &)=default
construct a copy an existing camera
FreeCam & operator=(FreeCam &&)=default
reassign an existing camera to ourselves
Abstract Class to represent a perspective camera. Stores aspect ratio and field of view.
Definition: PerspectiveCamera.hpp:11
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17