CIvfCamera Class Reference

#include <ivf/IvfCamera.h>

Inheritance diagram for CIvfCamera:

CIvfView CIvfObject CIvfBase CIvfRefCountBase CIvfRTTIBase List of all members.

Public Types

enum  TStereoEye { SE_LEFT, SE_RIGHT }
enum  TCameraType { CT_NORMAL, CT_FLY, CT_FREE_ORIENTATION }

Public Member Functions

CIvfVec3dgetForwardVector ()
CIvfVec3dgetTarget ()
 CIvfCamera ()
virtual ~CIvfCamera ()
 IvfClassInfo ("CIvfCamera", CIvfView)
void setPosition (GLdouble x, GLdouble y, GLdouble z)
void getPosition (GLdouble &x, GLdouble &y, GLdouble &z)
CIvfVec3dgetPosition ()
void setTarget (GLdouble x, GLdouble y, GLdouble z)
void getTarget (GLdouble &x, GLdouble &y, GLdouble &z)
void getUpVector (double *v)
void setPerspective (double fov, double zNear, double zFar)
void getPerspective (double &fov, double &zNear, double &zFar)
void getViewFrustum (CIvfViewFrustum *frustum)
void pickVector (int sx, int sy, double &vx, double &vy, double &vz)
CIvfVec3dpickVector (int x, int y)
void getForwardVector (double &vx, double &vy, double &vz)
void rotateTargetY (double angle)
void rotateTargetX (double angle)
void rotatePositionY (double angle)
void rotatePositionX (double angle)
void moveDepth (double d)
void moveVertical (double d)
void moveSideways (double d)
void setForwardVector (CIvfVec3d &vec)
void moveForward (double d)
void turn (double dx, double dy, double dz)
void setEyeSeparation (double separation)
double getEyeSeparation ()
void setStereoEye (TStereoEye eye)
void setStereo (bool flag)
bool getStereo ()
void setType (TCameraType type)
TCameraType getType ()
void getAbsoluteRotation (double &alfa, double &beta)
void rotateAbsolute (double alfa, double beta)
void moveAbsoluteDepth (double d)

Protected Member Functions

void calcOrientation ()
void projectionTransform ()
void viewTransform ()
void stereoTransform ()

Detailed Description

Camera/view class

CIvfCamera implements a virtual camera object supporting viewport definition, perspective transform, select functions and movement. To use the camera in OpenGL, it must be rendered using the render() method, as the first object in the scene. See the following code sample.

 void DisplayFunc(void)
 {
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   glPushMatrix();

   camera->rotatePositionY(...);
   camera->rotatePositionX(...);
   camera->moveSideways(...);
   camera->moveVertical(...);
   camera->moveDepth(...);
   camera->render();
        
   // Render other objects
        
   xx->render();
   ...
   root->render();
   ...

   glPopMatrix();
           
   glutSwapBuffers();
 }

 The camera must also be initialized before use this is often 
 done in a GLUT reshape callback or a MFC OnSize event method.
 The following code shows an example of a reshape callback.
 
 void ReshapeFunc(int w, int h)
 {
   camera->setPerspective(45.0, 0.1, 100.0);
   camera->setViewPort(w, h);
   camera->initialize();
 }

Author:
Jonas Lindemann
Examples:

ac3dreader.cpp, actionctl.cpp, advgeom.cpp, controllers.cpp, culling.cpp, extrusion.cpp, handlers.cpp, lighting.cpp, lod.cpp, manip.cpp, placement.cpp, robot.cpp, selection.cpp, and textures.cpp.

Definition at line 86 of file IvfCamera.h.


Constructor & Destructor Documentation

CIvfCamera::CIvfCamera  ) 
 

CIvfCamera constructor.

virtual CIvfCamera::~CIvfCamera  )  [virtual]
 

CIvfCamera destructor


Member Function Documentation

void CIvfCamera::getForwardVector double &  vx,
double &  vy,
double &  vz
 

Return forward vector.

Returns the normalized forward vector.

Parameters:
vx Forward vector x component.
vy Forward vector y component.
vz Forward vector z component.

void CIvfCamera::getPerspective double &  fov,
double &  zNear,
double &  zFar
 

Return perspective parameters

CIvfVec3d& CIvfCamera::getPosition  ) 
 

Return camera position

void CIvfCamera::getPosition GLdouble &  x,
GLdouble &  y,
GLdouble &  z
 

Return camera position

void CIvfCamera::getTarget GLdouble &  x,
GLdouble &  y,
GLdouble &  z
 

Return camera target position

void CIvfCamera::getUpVector double *  v  ) 
 

Returns camera up vector

void CIvfCamera::getViewFrustum CIvfViewFrustum frustum  )  [virtual]
 

Return the current view frustum

The function does not instantiate a view frustum class, but updates the input frustum with the correct values for the current camera view.

Reimplemented from CIvfView.

void CIvfCamera::moveDepth double  d  ) 
 

Move camera forward/backwards.

Move camera position forward along the forward vector.

Parameters:
d Distance to move camera. Positive forward.

void CIvfCamera::moveSideways double  d  ) 
 

Move camera sideways

Move camera sideways parallel to view plane.

Parameters:
d Distance to move camera. Positive right.

void CIvfCamera::moveVertical double  d  ) 
 

Move camera vertical

Move camera vertical parallel to view plane.

Parameters:
d Distance to move camera. Positive up.

void CIvfCamera::pickVector int  sx,
int  sy,
double &  vx,
double &  vy,
double &  vz
 

Retrieve pick vector

Calculates a vector starting at the eye position and intersecting the camera plane.

Parameters:
sx Viewport x coordinate.
sy Viewport y coordinate.
vx Pick vector x component
vy Pick vector y component
vz Pick vector z component

void CIvfCamera::rotatePositionX double  angle  ) 
 

Rotate camera position

Rotate camera point around target position.

Parameters:
angle Rotation angle around View Y-axis.

void CIvfCamera::rotatePositionY double  angle  ) 
 

Rotate camera position

Rotate camera point around target position.

Parameters:
angle Rotation angle around View Y-axis.

void CIvfCamera::rotateTargetX double  angle  ) 
 

Rotate target point

Rotate target point around camera position. (Not yet implemented)

Parameters:
angle Rotation angle around View Y-axis.

void CIvfCamera::rotateTargetY double  angle  ) 
 

Rotate target point

Rotate target point around camera position. (Not yet implemented)

Parameters:
angle Rotation angle around View X-axis.

void CIvfCamera::setForwardVector CIvfVec3d vec  ) 
 

Set camera forward vector

This method is used when int CT_FLY or CT_FREE_ORIENTATION mode, to set the forward camera direction.

void CIvfCamera::setPerspective double  fov,
double  zNear,
double  zFar
 

Set perspective parameters.

CIvfCamera using the gluPerspective to create the perspective transform. This method uses the same parameters as this function. See GLU documentation.

Parameters:
fov The field of view angle, in degrees, in the y-direction.
zNear The distance from the viewer to the near clipping plane (always positive).
zFar The distance from the viewer to the far clipping plane (always positive).

void CIvfCamera::setPosition GLdouble  x,
GLdouble  y,
GLdouble  z
 

Set camera position

Sets the camera position in the global coordinate system.

Parameters:
x X coordinate
y Y coordinate
z Z coordinate

void CIvfCamera::setTarget GLdouble  x,
GLdouble  y,
GLdouble  z
 

Set camera target position

The camera target defines the camera view direction. The position is defined in the global coordinate system.

Parameters:
x X coordinate
y Y coordinate
z Z coordinate


The documentation for this class was generated from the following file:
Generated on Fri Sep 1 15:36:49 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO