#include <CCamera.h>
Public Types | |
orthographic | |
perspective | |
enum | CameraType { orthographic, perspective } |
Public Member Functions | |
CCamera () | |
CCamera (double rdEyePosX, double rdEyePosY, double rdEyePosZ, double rdRefPointX, double rdRefPointY, double rdRefPointZ, double rdViewUpX, double rdViewUpY, double rdViewUpZ, const CBoundingBox3D &cBBox=CBoundingBox3D(-1,-1,-1, 1, 1, 1), double rdVerAngle=30.0, int nVPHeight=480, double rdRatio=4.0/3.0, double rdNearPlane=0.0001, double rdFarPlane=10000.0, int nTimeStep=0) | |
CCamera (CP3D cEyePos, CP3D cRefPoint, CV3D cViewUp, const CBoundingBox3D &cBBox=CBoundingBox3D(-1,-1,-1, 1, 1, 1), double rdVerAngle=30.0, int nVPHeight=480, double rdRatio=4.0/3.0, double rdNearPlane=0.0001, double rdFarPlane=10000.0, CameraType ctype=perspective, int nTimeStep=0) | |
virtual | ~CCamera () |
void | rotate (double rdAngle, CV3D cAxis, bool global=true) |
void | translate (CV3D vDiff) |
void | setRefPoint (const CP3D &cRefPoint) |
const CP3D & | getRefPoint () const |
void | setEyePos (const CP3D &cEyePos) |
const CP3D & | getEyePos () const |
void | setViewUp (const CV3D &cViewUp) |
const CV3D & | getViewUp () const |
const CV3D & | getViewDir () const |
const CV3D & | getViewRight () const |
void | setHVAngle (double rdHorAngle, double rdVerAngle) |
void | getHVAngle (double &rdHorAngle, double &rdVerAngle) const |
void | setClipPlanes (double rdNearPlane, double rdFarPlane) |
void | getClipPlanes (double &rdNearPlane, double &rdFarPlane) const |
void | setBoundingBox (const CBoundingBox3D &cBBox, bool fViewAll=true) |
const CBoundingBox3D & | getBoundingBox () const |
void | setCameraType (CameraType type) |
CameraType | getCameraType () const |
void | getVVolume (double array[6]) const |
void | setVPRes (int nVPWidth, int nVPHeight) |
void | getVPRes (int &nVPWidth, int &nVPHeight) const |
void | getVPParams (CP3D &origin, CV3D &xStep, CV3D &yStep, int nXSize, int nYSize) const |
CMat4D | getModelview () const |
CMat4D | getOrtho () const |
CMat4D | getFrustrum () const |
CMat4D | getProjection () const |
CMat4D | getVPTrans (int nXSize, int nYSize) const |
void | setRatio (double rdRatio) |
double | getRatio () const |
void | setFovy (double rdFovy) |
double | getFovy () const |
void | setVPHeight (int nVPHeight) |
int | getVPHeight () const |
void | setTimeStep (int nTimeStep) |
int | getTimeStep () const |
void | viewAll () |
void | print () |
Private Attributes | |
CameraType | m_CameraType |
CBoundingBox3D | m_cBBox |
double | m_rdVerAngle |
double | m_rdRatio |
double | m_rdNearPlane |
double | m_rdFarPlane |
int | m_nVPHeight |
bool | m_fValidViewDir |
bool | m_fValidViewRight |
CP3D | m_cEyePos |
CP3D | m_cRefPoint |
CV3D | m_cViewUp |
CV3D | m_cViewDir |
CV3D | m_cViewRight |
int | m_nTimeStep |
This class implements a camera including functionality to modify the camera (rotate, move, etc.).
enum CCamera::CameraType |
CCamera::CCamera | ( | ) | [inline] |
Default Constructor Eye is at (0,0,-1), center is at (0,0,0), and up is (0,1,0) and it has a boundingbox with the edge (-1,-1,-1) and (1,1,1).
CCamera::CCamera | ( | double | rdEyePosX, | |
double | rdEyePosY, | |||
double | rdEyePosZ, | |||
double | rdRefPointX, | |||
double | rdRefPointY, | |||
double | rdRefPointZ, | |||
double | rdViewUpX, | |||
double | rdViewUpY, | |||
double | rdViewUpZ, | |||
const CBoundingBox3D & | cBBox = CBoundingBox3D(-1, -1, -1, 1, 1, 1) , |
|||
double | rdVerAngle = 30.0 , |
|||
int | nVPHeight = 480 , |
|||
double | rdRatio = 4.0/3.0 , |
|||
double | rdNearPlane = 0.0001 , |
|||
double | rdFarPlane = 10000.0 , |
|||
int | nTimeStep = 0 | |||
) | [inline] |
Constructor defining the view parameters.
cEyePos | defines the eye position | |
cRefPoint | defines the reference point (focuspoint) | |
cViewUp | defines the view up vector | |
rdNearPlane | distance between the eyepoint and the near clipping plane | |
cBBox | the boundingbox of the whole scene | |
rdFarPlane | distance between the eyepoint and the far clipping plane | |
rdVerAngle | vertical open angle of the field of view | |
nVPHeight | resolution (in pixels) of the viewplane in y-direction | |
rdRatio | ratio between height and width, or hor. and vert. angle |
CCamera::CCamera | ( | CP3D | cEyePos, | |
CP3D | cRefPoint, | |||
CV3D | cViewUp, | |||
const CBoundingBox3D & | cBBox = CBoundingBox3D(-1, -1, -1, 1, 1, 1) , |
|||
double | rdVerAngle = 30.0 , |
|||
int | nVPHeight = 480 , |
|||
double | rdRatio = 4.0/3.0 , |
|||
double | rdNearPlane = 0.0001 , |
|||
double | rdFarPlane = 10000.0 , |
|||
CameraType | ctype = perspective , |
|||
int | nTimeStep = 0 | |||
) | [inline] |
The same as above but different types of parameters.
virtual CCamera::~CCamera | ( | ) | [inline, virtual] |
Default Destructor.
const CBoundingBox3D& CCamera::getBoundingBox | ( | ) | const [inline] |
Returns the boundingbox.
CameraType CCamera::getCameraType | ( | ) | const [inline] |
Returns the type of the camera (perspective or orthographic).
void CCamera::getClipPlanes | ( | double & | rdNearPlane, | |
double & | rdFarPlane | |||
) | const [inline] |
Returns the distance between eye point and near/far clipplane.
const CP3D& CCamera::getEyePos | ( | ) | const [inline] |
Get the current eye-point.
double CCamera::getFovy | ( | ) | const [inline] |
This method returns the fovy angle.
CMat4D CCamera::getFrustrum | ( | ) | const |
This method returns the glFrustrum() like matrix.
void CCamera::getHVAngle | ( | double & | rdHorAngle, | |
double & | rdVerAngle | |||
) | const [inline] |
Get horizontal and vertical angle of view of the camera.
CMat4D CCamera::getModelview | ( | ) | const |
This method gets you the modelview matrix of the current setup just like gluLookAt().
CMat4D CCamera::getOrtho | ( | ) | const |
This method returns the glOrtho() like matrix.
CMat4D CCamera::getProjection | ( | ) | const |
This method gets you the projection matrix of the current setup just like glFrustrum()/glOrtho().
double CCamera::getRatio | ( | ) | const [inline] |
This method returns the ratio.
const CP3D& CCamera::getRefPoint | ( | ) | const [inline] |
Get the current reference-point.
int CCamera::getTimeStep | ( | ) | const [inline] |
Get the TimeStep of the Camera for a 4DVolume
const CV3D & CCamera::getViewDir | ( | ) | const |
Get the current normalized viewdirection-vector.
const CV3D & CCamera::getViewRight | ( | ) | const |
Get the current normalized viewright-vector.
const CV3D& CCamera::getViewUp | ( | ) | const [inline] |
Get the current viewup-vector.
int CCamera::getVPHeight | ( | ) | const [inline] |
This method returns the vertical resolution of the viewplane.
void CCamera::getVPParams | ( | CP3D & | origin, | |
CV3D & | xStep, | |||
CV3D & | yStep, | |||
int | nXSize, | |||
int | nYSize | |||
) | const |
Returns all parameters of a viewplane which is orthogonal to the viewdirection and with a dimension of nXSize x nYSize.
origin | returns the upper left point. | |
xStep | returns the vector in x-direction from one pixel to another. | |
yStep | returns the vector in y-direction from one pixel to another. | |
rdXSize | the resolution of the viewplane in x-direction. | |
rdYSize | the resolution of the viewplane in y-direction. |
void CCamera::getVPRes | ( | int & | nVPWidth, | |
int & | nVPHeight | |||
) | const [inline] |
Returns the resolution of the viewplane in x- and y-direction.
CMat4D CCamera::getVPTrans | ( | int | nXSize, | |
int | nYSize | |||
) | const |
This method gets you the viewport transformation matrix of the current setup just like glViewport().
void CCamera::getVVolume | ( | double | array[6] | ) | const |
Returns the viewing volume. The values are in right order:
x-coordinate of the upper left corner,
x-coordinate of the lower right corner,
y-coordinate of the upper left corner,
y-coordinate of the lower right corner, and
the distance between eye point and near/far clipplane.
Hey, what a surprise! These are the values especially needed for the OpenGL functions 'glFrustum' or 'glOrtho' to set the projection matrix.
void CCamera::print | ( | ) |
Prints the camera parameter to standard output.
void CCamera::rotate | ( | double | rdAngle, | |
CV3D | cAxis, | |||
bool | global = true | |||
) |
Rotates the camera by an angle of 'rdAngle' degrees around an axis which goes through the reference point if 'global' is set to 'true'. If 'global' is 'false' the axis goes through the point of the eye position (for pitch, roll and yaw the camera). The direction of the axis is specified with 'cAxis'. This method changes the position of the camera if 'global' is 'true'.
void CCamera::setBoundingBox | ( | const CBoundingBox3D & | cBBox, | |
bool | fViewAll = true | |||
) | [inline] |
Sets the dimension of the scene as a boundingbox in world coordinates.
void CCamera::setCameraType | ( | CameraType | type | ) | [inline] |
Sets the type of the camera (perspective or orthographic).
void CCamera::setClipPlanes | ( | double | rdNearPlane, | |
double | rdFarPlane | |||
) | [inline] |
Set distance between eye point and near/far clipplane.
void CCamera::setEyePos | ( | const CP3D & | cEyePos | ) |
Set a new eye-point.
void CCamera::setFovy | ( | double | rdFovy | ) | [inline] |
This method sets the fovy (i.e. vertical opening) angle of the camera.
void CCamera::setHVAngle | ( | double | rdHorAngle, | |
double | rdVerAngle | |||
) | [inline] |
Don't use this method in new programs use 'setFovy()' and 'setRatio()' instead.
void CCamera::setRatio | ( | double | rdRatio | ) | [inline] |
This method sets the ratio between width and height (horizontal and vertical opening angle).
void CCamera::setRefPoint | ( | const CP3D & | cRefPoint | ) | [inline] |
Sets a new reference-point.
void CCamera::setTimeStep | ( | int | nTimeStep | ) | [inline] |
Set the TimeStep in a 4DVolume
void CCamera::setViewUp | ( | const CV3D & | cViewUp | ) | [inline] |
Set a new viewup-vector.
void CCamera::setVPHeight | ( | int | nVPHeight | ) | [inline] |
This method sets the vertical resolution of the viewplane.
void CCamera::setVPRes | ( | int | nVPWidth, | |
int | nVPHeight | |||
) | [inline] |
Don't use this method in new programs use 'setVPHeight()' and 'setRatio()' instead.
void CCamera::translate | ( | CV3D | vDiff | ) |
Move the camera relative to the current position by any distance in a 3-dimensional direction given by 'vDiff'.
void CCamera::viewAll | ( | ) |
Modifies the camera that the bounding box fits within the currently defined view frustum.
CameraType CCamera::m_CameraType [private] |
Reads a vector from the given stream.
CBoundingBox3D CCamera::m_cBBox [private] |
CP3D CCamera::m_cEyePos [private] |
CP3D CCamera::m_cRefPoint [private] |
CV3D CCamera::m_cViewDir [mutable, private] |
CV3D CCamera::m_cViewRight [mutable, private] |
CV3D CCamera::m_cViewUp [private] |
bool CCamera::m_fValidViewDir [mutable, private] |
bool CCamera::m_fValidViewRight [mutable, private] |
int CCamera::m_nTimeStep [private] |
int CCamera::m_nVPHeight [private] |
double CCamera::m_rdFarPlane [private] |
double CCamera::m_rdNearPlane [private] |
double CCamera::m_rdRatio [private] |
double CCamera::m_rdVerAngle [private] |