#include <ivf/IvfCamera.h>
Inheritance diagram for CIvfCamera:
Public Types | |
enum | TStereoEye { SE_LEFT, SE_RIGHT } |
enum | TCameraType { CT_NORMAL, CT_FLY, CT_FREE_ORIENTATION } |
Public Member Functions | |
CIvfVec3d & | getForwardVector () |
CIvfVec3d & | getTarget () |
CIvfCamera () | |
virtual | ~CIvfCamera () |
IvfClassInfo ("CIvfCamera", CIvfView) | |
void | setPosition (GLdouble x, GLdouble y, GLdouble z) |
void | getPosition (GLdouble &x, GLdouble &y, GLdouble &z) |
CIvfVec3d & | getPosition () |
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) |
CIvfVec3d & | pickVector (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 () |
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(); }
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.
|
CIvfCamera constructor. |
|
CIvfCamera destructor |
|
Return forward vector. Returns the normalized forward vector.
|
|
Return perspective parameters |
|
Return camera position |
|
Return camera position |
|
Return camera target position |
|
Returns camera up vector |
|
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. |
|
Move camera forward/backwards. Move camera position forward along the forward vector.
|
|
Move camera sideways Move camera sideways parallel to view plane.
|
|
Move camera vertical Move camera vertical parallel to view plane.
|
|
Retrieve pick vector Calculates a vector starting at the eye position and intersecting the camera plane.
|
|
Rotate camera position Rotate camera point around target position.
|
|
Rotate camera position Rotate camera point around target position.
|
|
Rotate target point Rotate target point around camera position. (Not yet implemented)
|
|
Rotate target point Rotate target point around camera position. (Not yet implemented)
|
|
Set camera forward vector This method is used when int CT_FLY or CT_FREE_ORIENTATION mode, to set the forward camera direction. |
|
Set perspective parameters. CIvfCamera using the gluPerspective to create the perspective transform. This method uses the same parameters as this function. See GLU documentation.
|
|
Set camera position Sets the camera position in the global coordinate system.
|
|
Set camera target position The camera target defines the camera view direction. The position is defined in the global coordinate system.
|