12#ifndef CSCI441_ARCBALL_CAM_HPP
13#define CSCI441_ARCBALL_CAM_HPP
15#include "PerspectiveCamera.hpp"
35 explicit ArcballCam(GLfloat minRadius = 2.0f, GLfloat maxRadius = 30.0f, GLfloat aspectRatio = 1.0f, GLfloat fovy = 45.0f, GLfloat nearClipPlane = 0.001f, GLfloat farClipPlane = 1000.0f);
63 void _updateArcballCameraViewMatrix();
82 const GLfloat minRadius,
83 const GLfloat maxRadius,
84 const GLfloat aspectRatio,
86 const GLfloat nearClipPlane,
87 const GLfloat farClipPlane
89 _minRadius(minRadius),
97 mCameraDirection.x = glm::sin(mCameraTheta ) * glm::sin(mCameraPhi ) * mCameraRadius;
98 mCameraDirection.y = -glm::cos(mCameraPhi ) * mCameraRadius;
99 mCameraDirection.z = -glm::cos(mCameraTheta ) * glm::sin(mCameraPhi ) * mCameraRadius;
101 _updateArcballCameraViewMatrix();
105 mCameraRadius -= movementFactor;
107 recomputeOrientation();
111 mCameraRadius += movementFactor;
113 recomputeOrientation();
116inline void CSCI441::ArcballCam::_updateArcballCameraViewMatrix() {
117 setPosition(mCameraLookAtPoint + mCameraDirection );
121inline void CSCI441::ArcballCam::_clampRadius() {
122 mCameraRadius = glm::clamp(mCameraRadius, _minRadius, _maxRadius);
A camera that implements an ArcBall camera model.
Definition: ArcballCam.hpp:23
void recomputeOrientation() final
converts spherical theta & phi to cartesian x,y,z direction vector
Definition: ArcballCam.hpp:95
void moveForward(GLfloat movementFactor) final
updates the camera's position by decreasing the camera's radius
Definition: ArcballCam.hpp:104
void moveBackward(GLfloat movementFactor) final
updates the camera's position by increasing the camera's radius
Definition: ArcballCam.hpp:110
ArcballCam(GLfloat minRadius=2.0f, GLfloat maxRadius=30.0f, GLfloat aspectRatio=1.0f, GLfloat fovy=45.0f, GLfloat nearClipPlane=0.001f, GLfloat farClipPlane=1000.0f)
initializes the Arcball Camera and sets the minimum/maximum radius the camera can zoom through as wel...
Definition: ArcballCam.hpp:81
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