NGL  6.5
The NCCA Graphics Library
ngl::PathCamera Class Reference

Inherits from Camera and adds a path for both eye and look using two Bezier Curves. More...

#include <PathCamera.h>

+ Inheritance diagram for ngl::PathCamera:
+ Collaboration diagram for ngl::PathCamera:

Public Member Functions

 PathCamera ()
 
 PathCamera (const Vec3 &_up, const BezierCurve &_eyePath, const BezierCurve &_lookPath, const Real _step) noexcept
 ctor using two curves More...
 
 PathCamera (const Vec3 &_up, Vec3 const *_eyePoints, int _nEyePoints, Vec3 const *_lookPoints, int _nLookPoints, Real _step) noexcept
 ctor using two arrays of points for the eye and look values these will be converted into BezierCurves for the actual camera paths More...
 
 PathCamera (const Vec4 &_up, const std::string &_fName, Real _step) noexcept
 ctor to load the camera data in from a file More...
 
 ~PathCamera () noexcept
 dtor More...
 
void update () noexcept
 update the camera by incrementing the step value and re-calculating the tx matrix More...
 
void updateLooped () noexcept
 update the camera by incrementing the step value and re-calculating the tx matrix if the camera is at the end of one of the paths it will return the other way More...
 
void drawPaths () const noexcept
 a method to draw the camera paths for debugging etc (note uses immediate mode GL) More...
 
void loadPath (const std::string &_fName) noexcept
 load a path from a file More...
 
void createCurvesForDrawing (int _lod) noexcept
 create the display lists for the paths so we can see them More...
 
- Public Member Functions inherited from ngl::Camera
 Camera () noexcept
 default constructor More...
 
 Camera (const Vec3 &_eye, const Vec3 &_look, const Vec3 &_up) noexcept
 constructor setting the camera using eye look and up More...
 
void roll (Real _angle) noexcept
 roll the cameara around the Z axis More...
 
void pitch (Real _angle) noexcept
 roll the cameara around the x axis More...
 
void yaw (Real _angle) noexcept
 roll the cameara around the y axis More...
 
void slide (Real _du, Real _dv, Real _dn) noexcept
 slide the camera around the U V and N axis More...
 
void set (const Vec3 &_eye, const Vec3 &_look, const Vec3 &_up) noexcept
 set the Camera position using eye look and up vectors More...
 
void setShape (Real _viewAngle, Real _aspect, Real _near, Real _far) noexcept
 set the shape of the Camera More...
 
void setAspect (Real _asp) noexcept
 re-set the aspect ratio of the camera More...
 
void setDefaultCamera () noexcept
 sets some nice default camera values More...
 
void move (Real _dx, Real _dy, Real _dz) noexcept
 move the camera in world space (i.e. add a translation to each of the axis More...
 
void moveBoth (Real _dx, Real _dy, Real _dz) noexcept
 move both the eye and the look at the same time More...
 
void moveEye (Real _dx, Real _dy, Real _dz) noexcept
 move the eye position More...
 
void moveLook (Real _dx, Real _dy, Real _dz) noexcept
 move the look position More...
 
void setViewAngle (Real _angle) noexcept
 set the viewangle for the Camera More...
 
void update () noexcept
 Use is called to make this the current camera and set the MODELVIEW and PROJECTION matrices in OpenGL. More...
 
void normalisedYaw (Real _angle) noexcept
 used to do a Yaw based on Euler rotation with normalised values More...
 
void normalisedPitch (Real _angle) noexcept
 used to do a Pitch based on Euler rotation with normalised values More...
 
void normalisedRoll (Real _angle) noexcept
 used to do a Roll based on Euler rotation with normalised values More...
 
void writeRib (RibExport &_rib) const noexcept
 write out the Camera so it may be used in Renderman, this writes a transform command in rib format so the OpenGL camera mirrors that of the renderman one More...
 
const Mat4getViewMatrix () noexcept
 accesor to get the view matrix More...
 
const Mat4getProjectionMatrix () noexcept
 accesor to get the projection matrix More...
 
Mat4 getVPMatrix () const noexcept
 get the View * Projection matrix used as part of the MVP calculations More...
 
Vec4 getEye () const noexcept
 get the eye position More...
 
void setEye (Vec4 _e) noexcept
 set the eye position and re-calculate the matrices More...
 
void setLook (Vec4 _e) noexcept
 set the look position and re-calculate the matrices More...
 
Vec4 getLook () const noexcept
 get the look position More...
 
Vec4 getUp () const noexcept
 get the up vector More...
 
Vec4 getU () const noexcept
 get the u vector More...
 
Vec4 getV () const noexcept
 get the v vector More...
 
Vec4 getN () const noexcept
 get the n vector More...
 
Real getFOV () const noexcept
 get the fov value More...
 
Real getAspect () const noexcept
 get the aspect value More...
 
Real getNear () const noexcept
 get the near clip value More...
 
Real getFar () const noexcept
 get the far clip value More...
 
void calculateFrustum () noexcept
 calculate the frustum for clipping etc More...
 
void drawFrustum () noexcept
 draw the frustum for clipping etc More...
 
CameraIntercept isPointInFrustum (const Vec3 &_p) const noexcept
 check to see if the point passed in is within the frustum More...
 
CameraIntercept isSphereInFrustum (const Vec3 &_p, Real _radius) const noexcept
 check to see if the sphere passed in is within the frustum More...
 
CameraIntercept boxInFrustum (const AABB &b) const noexcept
 check to see if the AABB passed in is within the frustum More...
 

Protected Types

enum  DIRECTION { CAMFWD, CAMBWD }
 enumeration for the camera's direction More...
 
- Protected Types inherited from ngl::Camera
enum  ProjPlane : char {
  ProjPlane::TOP = 0, ProjPlane::BOTTOM, ProjPlane::LEFT, ProjPlane::RIGHT,
  ProjPlane::NEARP, ProjPlane::FARP
}
 index values for the planes array More...
 

Protected Attributes

Real m_eyeCurvePoint
 the eye path of the camera's current position value More...
 
Real m_lookCurvePoint
 the look path of the camera's current position value More...
 
BezierCurve m_eyePath
 BezierCurve for the the eye positions. More...
 
BezierCurve m_lookPath
 BezierCurve for the look positions. More...
 
DIRECTION m_dir
 current direction of the camera More...
 
Real m_step
 the step for each update of the camera, the higher the number the smoother the movement More...
 
- Protected Attributes inherited from ngl::Camera
Vec4 m_u
 vector for the Camera local cord frame More...
 
Vec4 m_v
 vector for the Camera local cord frame More...
 
Vec4 m_n
 vector for the Camera local cord frame More...
 
Vec4 m_eye
 the position of the Camera used to calculate the local cord frame More...
 
Vec4 m_look
 where the camera is looking to, used with Eye to calculate the Vector m_n More...
 
Vec4 m_up
 gives a general indication of which way up the camera is More...
 
Real m_width
 the width of the display image used for some perspective projection calculations More...
 
Real m_height
 the height of the display image used for some perspective projection calculations More...
 
Real m_aspect
 used to store the current camera aspect ratio (can be derived from Width / Height More...
 
Real m_zNear
 the near clipping plane of the camera view volume More...
 
Real m_zFar
 the far clipping plane of the camera view volume More...
 
Real m_fov
 the feild of view of the camera view volume, measured from the eye More...
 
Mat4 m_viewMatrix
 a Matrix to hold the combined modelling and viewing matrix to load into OpenGL More...
 
Plane m_planes [6]
 array of planes for fustrum More...
 
Vec3 m_ntl
 points for the fustrum drawing More...
 
Vec3 m_ntr
 
Vec3 m_nbl
 
Vec3 m_nbr
 
Vec3 m_ftl
 
Vec3 m_ftr
 
Vec3 m_fbl
 
Vec3 m_fbr
 
Mat4 m_projectionMatrix
 Projection a Matrix to hold the perspective transfomatio matrix for the camera. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ngl::Camera
void setPerspProjection () noexcept
 function used to set the perspective projection matrix values More...
 
void rotAxes (Vec4 &io_a, Vec4 &io_b, const Real _angle) noexcept
 internal function to calculate the new rotation vectors for the camera after a roll, pitch or yaw More...
 
void setViewMatrix () noexcept
 method to set the modelview matrix values for the current camera, this method load the matrix Modelview into OpenGL More...
 
void setProjectionMatrix () noexcept
 set the projection matrix More...
 

Detailed Description

Inherits from Camera and adds a path for both eye and look using two Bezier Curves.

Definition at line 33 of file PathCamera.h.

Member Enumeration Documentation

enumeration for the camera's direction

Enumerator
CAMFWD 

camera going forward

CAMBWD 

camera going backwards

Definition at line 116 of file PathCamera.h.

Constructor & Destructor Documentation

ngl::PathCamera::PathCamera ( )
inline

Definition at line 38 of file PathCamera.h.

+ Here is the caller graph for this function:

ngl::PathCamera::PathCamera ( const Vec3 _up,
const BezierCurve _eyePath,
const BezierCurve _lookPath,
const Real  _step 
)
noexcept

ctor using two curves

Parameters
[in]_upthe up direction of the camera
[in]_eyePaththe BezierCurve for the eye path
[in]_lookPaththe BezierCurve for the look path
[in]_stepthe amount of step for the update
[in]_projthe type of projection for the camera to use

Definition at line 30 of file PathCamera.cpp.

References PathCamera().

+ Here is the call graph for this function:

ngl::PathCamera::PathCamera ( const Vec3 _up,
Vec3 const *  _eyePoints,
int  _nEyePoints,
Vec3 const *  _lookPoints,
int  _nLookPoints,
Real  _step 
)
noexcept

ctor using two arrays of points for the eye and look values these will be converted into BezierCurves for the actual camera paths

Parameters
[in]_upan indication of the camera's up direction
[in]_eyePointsa pointer to an array of points for the camera path
[in]_nEyePointsthe number of points in the _eyePoints array
[in]_lookPointsa pointer to an array of points for the camera look path
[in]_nLookPointsthe number of points in the _lookPoints array
[in]_stepthe amount of steps for the update
ngl::PathCamera::PathCamera ( const Vec4 _up,
const std::string _fName,
Real  _step 
)
noexcept

ctor to load the camera data in from a file

Parameters
[in]_upan indication of the camera up direction
[in]_fNamethe name of the file to load
[in]_stepthe amount of steps for the Update
[in]_projthe type of projection for the camera to use.

Definition at line 65 of file PathCamera.cpp.

ngl::PathCamera::~PathCamera ( )
noexcept

dtor

Definition at line 150 of file PathCamera.cpp.

Member Function Documentation

void ngl::PathCamera::createCurvesForDrawing ( int  _lod)
noexcept

create the display lists for the paths so we can see them

Parameters
[in]_lodthe level of detail for the paths display list

Definition at line 233 of file PathCamera.cpp.

References m_eyePath, m_lookPath, and ngl::BezierCurve::setLOD().

+ Here is the call graph for this function:

void ngl::PathCamera::drawPaths ( ) const
noexcept

a method to draw the camera paths for debugging etc (note uses immediate mode GL)

Todo:
write code to do the drawing

Definition at line 228 of file PathCamera.cpp.

void ngl::PathCamera::loadPath ( const std::string _fName)
noexcept

load a path from a file

Parameters
[in]_fNamethe name of the file to load
Todo:
get this working with loading from a Vector

Definition at line 113 of file PathCamera.cpp.

void ngl::PathCamera::update ( )
noexcept

update the camera by incrementing the step value and re-calculating the tx matrix

Definition at line 156 of file PathCamera.cpp.

References ngl::Vec4::cross(), ngl::BezierCurve::getPointOnCurve(), ngl::Camera::m_eye, m_eyeCurvePoint, m_eyePath, ngl::Camera::m_look, m_lookCurvePoint, m_lookPath, ngl::Camera::m_n, m_step, ngl::Camera::m_u, ngl::Camera::m_up, ngl::Camera::m_v, ngl::Vec4::normalize(), ngl::Vec4::set(), and ngl::Camera::setViewMatrix().

+ Here is the call graph for this function:

void ngl::PathCamera::updateLooped ( )
noexcept

update the camera by incrementing the step value and re-calculating the tx matrix if the camera is at the end of one of the paths it will return the other way

Definition at line 183 of file PathCamera.cpp.

References CAMBWD, CAMFWD, ngl::Vec4::cross(), ngl::BezierCurve::getPointOnCurve(), m_dir, ngl::Camera::m_eye, m_eyeCurvePoint, m_eyePath, ngl::Camera::m_look, m_lookCurvePoint, m_lookPath, ngl::Camera::m_n, m_step, ngl::Camera::m_u, ngl::Camera::m_up, ngl::Camera::m_v, ngl::Vec4::normalize(), ngl::Vec4::set(), and ngl::Camera::setViewMatrix().

+ Here is the call graph for this function:

Member Data Documentation

DIRECTION ngl::PathCamera::m_dir
protected

current direction of the camera

Definition at line 126 of file PathCamera.h.

Real ngl::PathCamera::m_eyeCurvePoint
protected

the eye path of the camera's current position value

Definition at line 101 of file PathCamera.h.

BezierCurve ngl::PathCamera::m_eyePath
protected

BezierCurve for the the eye positions.

Definition at line 109 of file PathCamera.h.

Real ngl::PathCamera::m_lookCurvePoint
protected

the look path of the camera's current position value

Definition at line 105 of file PathCamera.h.

BezierCurve ngl::PathCamera::m_lookPath
protected

BezierCurve for the look positions.

Definition at line 112 of file PathCamera.h.

Real ngl::PathCamera::m_step
protected

the step for each update of the camera, the higher the number the smoother the movement

Definition at line 130 of file PathCamera.h.


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