CSCI441 OpenGL Library 5.9.0
CS@Mines CSCI441 Computer Graphics Course Library
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CSCI441::Camera Class Referenceabstract

Abstract Class to represent a synthetic camera. The following methods must be overridden:
More...

#include <Camera.hpp>

Inheritance diagram for CSCI441::Camera:
CSCI441::MD5Camera CSCI441::OrthographicCamera CSCI441::PerspectiveCamera CSCI441::HUDCamera CSCI441::ArcballCam CSCI441::FixedCam CSCI441::FreeCam

Public Member Functions

virtual ~Camera ()=default
 properly destroy concrete children
 
virtual void recomputeOrientation ()=0
 Uses theta, phi, & radius to update the camera's view matrix parameters. The camera orientation is controlled via spherical coordinates and this method would orient and/or position the camera in cartesian coordinates.
 
virtual void moveForward (GLfloat movementFactor)=0
 steps forward along the camera's view
 
virtual void moveBackward (GLfloat movementFactor)=0
 steps backward along the camera's view
 
virtual void rotate (GLfloat dTheta, GLfloat dPhi)
 rotates the camera's POV by adding to theta & phi then ensuring phi stays within the (0, pi) range and finally calls through to recomputeOrientation() to update the view parameters after the rotation
 
virtual void computeViewMatrix () final
 creates the View Matrix based on the position, lookAt point, and up vector
 
virtual glm::mat4 getProjectionMatrix () const final
 returns the current projection matrix for the associated camera
 
virtual glm::mat4 getViewMatrix () const final
 returns the current view matrix for the associated camera
 
virtual glm::vec3 getPosition () const final
 returns the current camera position in world space
 
virtual glm::vec3 getLookAtPoint () const final
 returns the current lookAt point in world space
 
virtual glm::vec3 getUpVector () const final
 returns the current up vector in world space
 
virtual GLfloat getTheta () const final
 returns the current theta value in radians
 
virtual GLfloat getPhi () const final
 returns the current phi value in radians
 
GLfloat getRadius () const
 returns the current radius in world space
 
virtual void setPosition (const glm::vec3 pos) final
 sets the camera's position in world space
 
virtual void setLookAtPoint (const glm::vec3 lookAt) final
 sets the camera's lookAt point in world space
 
virtual void setUpVector (const glm::vec3 up) final
 sets the camera's up vector in world space
 
virtual void setTheta (const GLfloat t) final
 sets the camera's theta angle in radians
 
virtual void setPhi (const GLfloat p) final
 sets the camera's phi angle in radians
 
virtual void setRadius (const GLfloat r) final
 sets the camera's radius in world space
 

Protected Member Functions

 Camera ()
 create a default camera at the origin, looking down the negative Z axis oriented with the world coordinate system
 

Protected Attributes

glm::mat4 mProjectionMatrix
 stores the Projection Matrix
 
glm::mat4 mViewMatrix
 stores the View Matrix corresponding to the inverse of the Camera's Matrix
 
glm::vec3 mCameraPosition
 the cartesian position in world space of the camera
 
glm::vec3 mCameraDirection
 the cartesian direction the camera is facing in world space
 
glm::vec3 mCameraLookAtPoint
 the world space point in front of the camera
 
glm::vec3 mCameraUpVector
 the up vector of the camera specified in world space
 
GLfloat mCameraTheta
 spherical angle for yaw direction in radians
 
GLfloat mCameraPhi
 spherical angle for pitch direction in radians
 
GLfloat mCameraRadius
 spherical magnitude for direction in world space
 

Detailed Description

Abstract Class to represent a synthetic camera. The following methods must be overridden:

Member Function Documentation

◆ getLookAtPoint()

virtual glm::vec3 CSCI441::Camera::getLookAtPoint ( ) const
inlinefinalvirtual

returns the current lookAt point in world space

Returns
homogeneous world space point

◆ getPhi()

virtual GLfloat CSCI441::Camera::getPhi ( ) const
inlinefinalvirtual

returns the current phi value in radians

Returns
spherical phi coordinate

◆ getPosition()

virtual glm::vec3 CSCI441::Camera::getPosition ( ) const
inlinefinalvirtual

returns the current camera position in world space

Returns
homogeneous world space point

◆ getProjectionMatrix()

virtual glm::mat4 CSCI441::Camera::getProjectionMatrix ( ) const
inlinefinalvirtual

returns the current projection matrix for the associated camera

Returns
homogeneous projection matrix

◆ getRadius()

GLfloat CSCI441::Camera::getRadius ( ) const
inline

returns the current radius in world space

Returns
spherical radius coordinate

◆ getTheta()

virtual GLfloat CSCI441::Camera::getTheta ( ) const
inlinefinalvirtual

returns the current theta value in radians

Returns
spherical theta coordinate

◆ getUpVector()

virtual glm::vec3 CSCI441::Camera::getUpVector ( ) const
inlinefinalvirtual

returns the current up vector in world space

Returns
homogeneous world space vector

◆ getViewMatrix()

virtual glm::mat4 CSCI441::Camera::getViewMatrix ( ) const
inlinefinalvirtual

returns the current view matrix for the associated camera

Returns
homogeneous view matrix

◆ moveBackward()

virtual void CSCI441::Camera::moveBackward ( GLfloat  movementFactor)
pure virtual

steps backward along the camera's view

Parameters
movementFactorscaling factor for distance to move

Implemented in CSCI441::FixedCam, CSCI441::HUDCamera, CSCI441::ArcballCam, CSCI441::FreeCam, and CSCI441::MD5Camera.

◆ moveForward()

virtual void CSCI441::Camera::moveForward ( GLfloat  movementFactor)
pure virtual

steps forward along the camera's view

Parameters
movementFactorscaling factor for distance to move

Implemented in CSCI441::FixedCam, CSCI441::HUDCamera, CSCI441::ArcballCam, CSCI441::FreeCam, and CSCI441::MD5Camera.

◆ recomputeOrientation()

virtual void CSCI441::Camera::recomputeOrientation ( )
pure virtual

Uses theta, phi, & radius to update the camera's view matrix parameters. The camera orientation is controlled via spherical coordinates and this method would orient and/or position the camera in cartesian coordinates.

Implemented in CSCI441::ArcballCam, CSCI441::FixedCam, CSCI441::FreeCam, CSCI441::HUDCamera, and CSCI441::MD5Camera.

◆ rotate()

void CSCI441::Camera::rotate ( GLfloat  dTheta,
GLfloat  dPhi 
)
inlinevirtual

rotates the camera's POV by adding to theta & phi then ensuring phi stays within the (0, pi) range and finally calls through to recomputeOrientation() to update the view parameters after the rotation

Parameters
dThetachange in rotation of theta represented in radians
dPhichange in rotation of phi represented in radians
Note
There is a default implementation to update theta & phi, but the method is overridable in the event a camera should be fixed and rotation can then be disabled.

◆ setLookAtPoint()

virtual void CSCI441::Camera::setLookAtPoint ( const glm::vec3  lookAt)
inlinefinalvirtual

sets the camera's lookAt point in world space

Parameters
lookAtthe new camera world space lookAt point

◆ setPhi()

virtual void CSCI441::Camera::setPhi ( const GLfloat  p)
inlinefinalvirtual

sets the camera's phi angle in radians

Parameters
pthe new camera phi angle in radians

◆ setPosition()

virtual void CSCI441::Camera::setPosition ( const glm::vec3  pos)
inlinefinalvirtual

sets the camera's position in world space

Parameters
posthe new camera world space position

◆ setRadius()

virtual void CSCI441::Camera::setRadius ( const GLfloat  r)
inlinefinalvirtual

sets the camera's radius in world space

Parameters
rthe new camera radius in world space

◆ setTheta()

virtual void CSCI441::Camera::setTheta ( const GLfloat  t)
inlinefinalvirtual

sets the camera's theta angle in radians

Parameters
tthe new camera theta angle in radians

◆ setUpVector()

virtual void CSCI441::Camera::setUpVector ( const glm::vec3  up)
inlinefinalvirtual

sets the camera's up vector in world space

Parameters
upthe new camera world space up vector

The documentation for this class was generated from the following file: