diff --git a/Camera.hpp b/Camera.hpp index 3919453f..e6460b97 100644 --- a/Camera.hpp +++ b/Camera.hpp @@ -197,8 +197,10 @@ namespace CSCI441 { GLfloat mCameraRadius; private: - // keeps phi within the range (0, pi) to prevent the camera from flipping upside down - // instead, alter up vector to flip/rotate camera orientation + /** + * @brief keeps phi within the range (0, pi) to prevent the camera from flipping upside down + * @note to invert camera - alter the up vector to flip/rotate camera orientation + */ void _clampCameraPhi(); }; } diff --git a/docs/_camera_8hpp_source.html b/docs/_camera_8hpp_source.html index b683b06c..0b2c5ab7 100644 --- a/docs/_camera_8hpp_source.html +++ b/docs/_camera_8hpp_source.html @@ -135,43 +135,41 @@
197 GLfloat mCameraRadius;
198
199 private:
-
200 // keeps phi within the range (0, pi) to prevent the camera from flipping upside down
-
201 // instead, alter up vector to flip/rotate camera orientation
-
202 void _clampCameraPhi();
-
203 };
-
204}
-
205
-
206inline CSCI441::Camera::Camera() :
-
207 mProjectionMatrix( glm::mat4(1.0f) ),
-
208 mViewMatrix( glm::mat4(1.0f) ),
-
209 mCameraPosition( glm::vec3(0.0f, 0.0f, 0.0f ) ),
-
210 mCameraDirection( glm::vec3(0.0f, 0.0f, -1.0f ) ),
-
211 mCameraLookAtPoint( glm::vec3(0.0f, 0.0f, -1.0f ) ),
-
212 mCameraUpVector( glm::vec3(0.0f, 1.0f, 0.0f ) ),
-
213 mCameraTheta( 0.0f ),
-
214 mCameraPhi( M_PI / 2.0f ),
-
215 mCameraRadius( 1.0f ) {
-
216}
-
217
-
218[[maybe_unused]]
-
219inline void CSCI441::Camera::rotate(const GLfloat dTheta, const GLfloat dPhi) {
-
220 mCameraTheta += dTheta; // update theta
-
221 mCameraPhi += dPhi; // update phi
-
222 _clampCameraPhi(); // bounds check phi
-
223 recomputeOrientation(); // convert to cartesian
-
224}
-
225
-
226inline void CSCI441::Camera::_clampCameraPhi() {
-
227 if(mCameraPhi <= 0.0f) mCameraPhi = 0.0f + 0.001f;
-
228 if(mCameraPhi >= M_PI) mCameraPhi = M_PI - 0.001f;
-
229}
-
230
-
231#endif // CSCI441_CAMERA_HPP
+
204 void _clampCameraPhi();
+
205 };
+
206}
+
207
+
208inline CSCI441::Camera::Camera() :
+
209 mProjectionMatrix( glm::mat4(1.0f) ),
+
210 mViewMatrix( glm::mat4(1.0f) ),
+
211 mCameraPosition( glm::vec3(0.0f, 0.0f, 0.0f ) ),
+
212 mCameraDirection( glm::vec3(0.0f, 0.0f, -1.0f ) ),
+
213 mCameraLookAtPoint( glm::vec3(0.0f, 0.0f, -1.0f ) ),
+
214 mCameraUpVector( glm::vec3(0.0f, 1.0f, 0.0f ) ),
+
215 mCameraTheta( 0.0f ),
+
216 mCameraPhi( M_PI / 2.0f ),
+
217 mCameraRadius( 1.0f ) {
+
218}
+
219
+
220[[maybe_unused]]
+
221inline void CSCI441::Camera::rotate(const GLfloat dTheta, const GLfloat dPhi) {
+
222 mCameraTheta += dTheta; // update theta
+
223 mCameraPhi += dPhi; // update phi
+
224 _clampCameraPhi(); // bounds check phi
+
225 recomputeOrientation(); // convert to cartesian
+
226}
+
227
+
228inline void CSCI441::Camera::_clampCameraPhi() {
+
229 if(mCameraPhi <= 0.0f) mCameraPhi = 0.0f + 0.001f;
+
230 if(mCameraPhi >= M_PI) mCameraPhi = M_PI - 0.001f;
+
231}
+
232
+
233#endif // CSCI441_CAMERA_HPP
CSCI441::Camera
Abstract Class to represent a synthetic camera. The following methods must be overridden:
Definition: Camera.hpp:35
CSCI441::Camera::mCameraPhi
GLfloat mCameraPhi
spherical angle for pitch direction in radians
Definition: Camera.hpp:193
CSCI441::Camera::getProjectionMatrix
glm::mat4 getProjectionMatrix() const
returns the current projection matrix for the associated camera
Definition: Camera.hpp:84
CSCI441::Camera::setUpVector
void setUpVector(const glm::vec3 up)
sets the camera's up vector in world space
Definition: Camera.hpp:135
-
CSCI441::Camera::Camera
Camera()
create a default camera at the origin, looking down the negative Z axis oriented with the world coord...
Definition: Camera.hpp:206
+
CSCI441::Camera::Camera
Camera()
create a default camera at the origin, looking down the negative Z axis oriented with the world coord...
Definition: Camera.hpp:208
CSCI441::Camera::moveBackward
virtual void moveBackward(GLfloat movementFactor)=0
steps backward along the camera's view
CSCI441::Camera::getPhi
GLfloat getPhi() const
returns the current phi value in radians
Definition: Camera.hpp:114
CSCI441::Camera::getPosition
glm::vec3 getPosition() const
returns the current camera position in world space
Definition: Camera.hpp:94
@@ -196,7 +194,7 @@
CSCI441::Camera::mCameraRadius
GLfloat mCameraRadius
spherical magnitude for direction in world space
Definition: Camera.hpp:197
CSCI441::Camera::getTheta
GLfloat getTheta() const
returns the current theta value in radians
Definition: Camera.hpp:109
CSCI441::Camera::setRadius
void setRadius(const GLfloat r)
sets the camera's radius in world space
Definition: Camera.hpp:150
-
CSCI441::Camera::rotate
virtual void rotate(GLfloat dTheta, GLfloat dPhi)
rotates the camera's POV by adding to theta & phi then ensuring phi stays within the (0,...
Definition: Camera.hpp:219
+
CSCI441::Camera::rotate
virtual void rotate(GLfloat dTheta, GLfloat dPhi)
rotates the camera's POV by adding to theta & phi then ensuring phi stays within the (0,...
Definition: Camera.hpp:221
CSCI441::Camera::getRadius
GLfloat getRadius() const
returns the current radius in world space
Definition: Camera.hpp:119
CSCI441
CSCI441 Helper Functions for OpenGL.
Definition: ArcballCam.hpp:17