GLC_Camera Class Reference

GLC_Camera : OpenGL perpective viewpoint. More...

#include <glc_camera.h>

Inheritance diagram for GLC_Camera:
GLC_Object

List of all members.

Public Member Functions

Constructor / Destructor

 GLC_Camera ()
 Default constructor.
 GLC_Camera (const GLC_Point3d &, const GLC_Point3d &, const GLC_Vector3d &)
 Explicit constructor.
 GLC_Camera (const GLC_Camera &)
 Copy constructor.
Get Functions

double distEyeTarget (void) const
 Get the distance between the eye and the target of camera.
GLC_Point3d eye (void) const
 Get camera's eye coordinate point.
GLC_Point3d target (void) const
 Get camera's target coordinate point.
GLC_Vector3d upVector (void) const
 Get camera's Up vector.
GLC_Vector3d forward (void) const
 Get camera's forward vector (from eye to target).
GLC_Vector3d sideVector () const
 Side camera vector.
GLC_Matrix4x4 viewMatrix (void) const
 Get camera's orbit composition matrix.
bool operator== (const GLC_Camera &) const
 equality operator
bool isAlmostEqualTo (const GLC_Camera &, const double distanceAccuracy=0.05) const
 almost equality (Bauer Laurent)
GLC_Vector3d defaultUpVector () const
 Return the default up vector.
GLC_Camera frontView () const
 Return the standard front view form this camera.
GLC_Camera rearView () const
 Return the standard rear view form this camera.
GLC_Camera rightView () const
 Return the standard right view form this camera.
GLC_Camera leftView () const
 Return the standard left view form this camera.
GLC_Camera topView () const
 Return the standard top view form this camera.
GLC_Camera bottomView () const
 Return the standard bottom view form this camera.
GLC_Camera isoView () const
 Return the standard isoview from his camera.
GLC_Matrix4x4 modelViewMatrix () const
 Return the model view matrix of the camera.
Set Functions

GLC_Cameraorbit (GLC_Vector3d VectOldPoss, GLC_Vector3d VectCurPoss)
 Camera orbiting.
GLC_Camerapan (GLC_Vector3d VectDep)
 panoramic movement
GLC_Camerazoom (double factor)
 move camera's eye along camera vector (eye -> target)
GLC_Cameramove (const GLC_Matrix4x4 &MatMove)
 Move camera.
GLC_CamerarotateAround (const GLC_Vector3d &, const double &, const GLC_Point3d &)
 Rotate around an axis.
GLC_CamerarotateAroundTarget (const GLC_Vector3d &, const double &)
 Rotate around camera target.
GLC_Cameratranslate (const GLC_Vector3d &VectTrans)
 Camera translation.
GLC_CamerasetCam (GLC_Point3d Eye, GLC_Point3d Target, GLC_Vector3d Up)
 Set the camera.
GLC_CamerasetCam (const GLC_Camera &)
 Set the camera by copying another camera.
GLC_CamerasetEyeCam (const GLC_Point3d &Eye)
 Set camera's eye coordinate vector.
GLC_CamerasetTargetCam (const GLC_Point3d &Target)
 Set camera's target coordinate vector.
GLC_CamerasetUpCam (const GLC_Vector3d &Up)
 Set camera's Up vector.
GLC_CamerasetDistEyeTarget (double Longueur)
 Set the distance between eye and target (move eye).
GLC_CamerasetDistTargetEye (double Longueur)
 Set the distance between target and eye (move target).
GLC_Cameraoperator= (const GLC_Camera &)
 Assignement operator.
GLC_CamerasetDefaultUpVector (const GLC_Vector3d &up)
 Set the default Up vector.
void setFrontView ()
 Set the standard front view form this camera.
void setRearView ()
 Set the standard rear view form this camera.
void setRightView ()
 Set the standard right view form this camera.
void setLeftView ()
 Set the standard left view form this camera.
void setTopView ()
 Set the standard top view form this camera.
void setBottomView ()
 Set the standard bottom view form this camera.
void setIsoView ()
 Set the standard isoview from his camera.
OpenGL Functions

void glExecute ()
 Execute OpenGL Camera.

Private Member Functions

void createMatComp (void)
 compute composition matrix

Private Attributes

GLC_Point3d m_Eye
 Camera's eye point.
GLC_Point3d m_Target
 Camera's target point.
GLC_Vector3d m_VectUp
 Camera's Up vector.
GLC_Matrix4x4 m_ModelViewMatrix
 Camera model view matrix.
GLC_Vector3d m_DefaultVectUp
 The default Up axis.

Detailed Description

GLC_Camera : OpenGL perpective viewpoint.

An GLC_Camera define Viewpoint and orientation of an OpenGL perpective camera

Definition at line 43 of file glc_camera.h.


Constructor & Destructor Documentation

GLC_Camera::GLC_Camera (  ) 

Default constructor.

Point of view (0, 0, 1) Up Vector (0, 1, 0)

Definition at line 34 of file glc_camera.cpp.

GLC_Camera::GLC_Camera ( const GLC_Point3d Eye,
const GLC_Point3d Target,
const GLC_Vector3d Up 
)

Explicit constructor.

Definition at line 45 of file glc_camera.cpp.

References createMatComp(), and setCam().

GLC_Camera::GLC_Camera ( const GLC_Camera cam  ) 

Copy constructor.

Definition at line 58 of file glc_camera.cpp.


Member Function Documentation

GLC_Camera GLC_Camera::bottomView (  )  const

Return the standard bottom view form this camera.

Definition at line 396 of file glc_camera.cpp.

References glc::PI, rotateAroundTarget(), topView(), and upVector().

void GLC_Camera::createMatComp ( void   )  [private]

compute composition matrix

Definition at line 443 of file glc_camera.cpp.

References forward(), m_Eye, m_ModelViewMatrix, m_Target, m_VectUp, GLC_Matrix4x4::setData(), GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

Referenced by GLC_Camera(), move(), orbit(), and setCam().

GLC_Vector3d GLC_Camera::defaultUpVector (  )  const [inline]

Return the default up vector.

Definition at line 105 of file glc_camera.h.

Referenced by GLC_TurnTableMover::init(), and GLC_TurnTableMover::move().

double GLC_Camera::distEyeTarget ( void   )  const [inline]

Get the distance between the eye and the target of camera.

Definition at line 71 of file glc_camera.h.

Referenced by frontView(), GLC_RepCrossMover::glDraw(), isoView(), GLC_Viewport::mapPosMouse(), GLC_TsrMover::move(), GLC_Viewport::setDistMinAndMax(), topView(), and GLC_Viewport::updateProjectionMat().

GLC_Point3d GLC_Camera::eye ( void   )  const [inline]
GLC_Vector3d GLC_Camera::forward ( void   )  const [inline]
GLC_Camera GLC_Camera::frontView (  )  const

Return the standard front view form this camera.

Definition at line 335 of file glc_camera.cpp.

References distEyeTarget(), eye(), m_DefaultVectUp, m_Target, setDefaultUpVector(), setDistEyeTarget(), GLC_Vector3d::setVect(), and glc::Z_AXIS().

Referenced by leftView(), rearView(), and rightView().

void GLC_Camera::glExecute (  ) 

Execute OpenGL Camera.

Definition at line 432 of file glc_camera.cpp.

References m_Eye, m_Target, m_VectUp, GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

Referenced by GLC_Viewport::glExecuteCam().

bool GLC_Camera::isAlmostEqualTo ( const GLC_Camera cam,
const double  distanceAccuracy = 0.05 
) const

almost equality (Bauer Laurent)

Definition at line 321 of file glc_camera.cpp.

References GLC_Vector3d::length(), m_Eye, m_Target, and m_VectUp.

GLC_Camera GLC_Camera::isoView (  )  const

Return the standard isoview from his camera.

Iso View is at the front top left

Definition at line 405 of file glc_camera.cpp.

References distEyeTarget(), eye(), m_DefaultVectUp, m_Target, setDefaultUpVector(), setDistEyeTarget(), GLC_Vector3d::setVect(), glc::Y_AXIS(), and glc::Z_AXIS().

GLC_Camera GLC_Camera::leftView (  )  const

Return the standard left view form this camera.

Definition at line 367 of file glc_camera.cpp.

References frontView(), m_DefaultVectUp, glc::PI, and rotateAroundTarget().

GLC_Matrix4x4 GLC_Camera::modelViewMatrix (  )  const [inline]

Return the model view matrix of the camera.

Definition at line 131 of file glc_camera.h.

Referenced by GLC_Viewport::compositionMatrix(), GLC_Viewport::setDistMinAndMax(), GLC_Viewport::unproject(), and GLC_Viewport::unProject().

GLC_Camera & GLC_Camera::move ( const GLC_Matrix4x4 MatMove  ) 
GLC_Camera & GLC_Camera::operator= ( const GLC_Camera cam  ) 

Assignement operator.

Definition at line 309 of file glc_camera.cpp.

References m_DefaultVectUp, m_Eye, m_ModelViewMatrix, m_Target, and m_VectUp.

bool GLC_Camera::operator== ( const GLC_Camera cam  )  const

equality operator

Definition at line 74 of file glc_camera.cpp.

References m_DefaultVectUp, m_Eye, m_Target, and m_VectUp.

GLC_Camera & GLC_Camera::orbit ( GLC_Vector3d  VectOldPoss,
GLC_Vector3d  VectCurPoss 
)
GLC_Camera & GLC_Camera::pan ( GLC_Vector3d  VectDep  ) 

panoramic movement

Definition at line 109 of file glc_camera.cpp.

References GLC_Matrix4x4::invert(), m_Eye, m_ModelViewMatrix, and m_Target.

Referenced by GLC_SetTargetMover::init(), GLC_TsrMover::move(), and GLC_PanMover::move().

GLC_Camera GLC_Camera::rearView (  )  const

Return the standard rear view form this camera.

Definition at line 356 of file glc_camera.cpp.

References frontView(), m_DefaultVectUp, glc::PI, and rotateAroundTarget().

GLC_Camera GLC_Camera::rightView (  )  const

Return the standard right view form this camera.

Definition at line 362 of file glc_camera.cpp.

References frontView(), m_DefaultVectUp, glc::PI, and rotateAroundTarget().

GLC_Camera & GLC_Camera::rotateAround ( const GLC_Vector3d axis,
const double &  angle,
const GLC_Point3d point 
)

Rotate around an axis.

Definition at line 150 of file glc_camera.cpp.

References move(), and translate().

Referenced by GLC_TsrMover::move(), and rotateAroundTarget().

GLC_Camera & GLC_Camera::rotateAroundTarget ( const GLC_Vector3d axis,
const double &  angle 
)

Rotate around camera target.

Definition at line 161 of file glc_camera.cpp.

References m_Target, rotateAround(), and target().

Referenced by bottomView(), leftView(), GLC_TurnTableMover::move(), rearView(), and rightView().

void GLC_Camera::setBottomView (  )  [inline]

Set the standard bottom view form this camera.

Definition at line 224 of file glc_camera.h.

GLC_Camera & GLC_Camera::setCam ( const GLC_Camera cam  ) 

Set the camera by copying another camera.

Definition at line 280 of file glc_camera.cpp.

References m_Eye, m_ModelViewMatrix, m_Target, and m_VectUp.

GLC_Camera & GLC_Camera::setCam ( GLC_Point3d  Eye,
GLC_Point3d  Target,
GLC_Vector3d  Up 
)

Set the camera.

Definition at line 252 of file glc_camera.cpp.

References createMatComp(), m_Eye, m_Target, m_VectUp, glc::PI, and GLC_Vector3d::setLength().

Referenced by GLC_Camera(), setEyeCam(), setTargetCam(), and setUpCam().

GLC_Camera& GLC_Camera::setDefaultUpVector ( const GLC_Vector3d up  )  [inline]

Set the default Up vector.

Must Be X, Y or Z Axis

Definition at line 196 of file glc_camera.h.

References glc::X_AXIS(), glc::Y_AXIS(), and glc::Z_AXIS().

Referenced by frontView(), isoView(), and topView().

GLC_Camera & GLC_Camera::setDistEyeTarget ( double  Longueur  ) 

Set the distance between eye and target (move eye).

Definition at line 291 of file glc_camera.cpp.

References forward(), m_Eye, m_Target, and GLC_Vector3d::setLength().

Referenced by frontView(), isoView(), GLC_Viewport::reframe(), and topView().

GLC_Camera & GLC_Camera::setDistTargetEye ( double  Longueur  ) 

Set the distance between target and eye (move target).

Definition at line 299 of file glc_camera.cpp.

References forward(), m_Eye, m_Target, and GLC_Vector3d::setLength().

Referenced by GLC_FlyMover::init(), and GLC_FlyMover::move().

GLC_Camera & GLC_Camera::setEyeCam ( const GLC_Point3d Eye  ) 

Set camera's eye coordinate vector.

Definition at line 177 of file glc_camera.cpp.

References GLC_Vector3d::invert(), m_Eye, m_Target, m_VectUp, glc::PI, setCam(), and GLC_Vector3d::setLength().

void GLC_Camera::setFrontView (  )  [inline]

Set the standard front view form this camera.

Definition at line 204 of file glc_camera.h.

void GLC_Camera::setIsoView (  )  [inline]

Set the standard isoview from his camera.

Iso View is at the front top left

Definition at line 229 of file glc_camera.h.

void GLC_Camera::setLeftView (  )  [inline]

Set the standard left view form this camera.

Definition at line 216 of file glc_camera.h.

void GLC_Camera::setRearView (  )  [inline]

Set the standard rear view form this camera.

Definition at line 208 of file glc_camera.h.

void GLC_Camera::setRightView (  )  [inline]

Set the standard right view form this camera.

Definition at line 212 of file glc_camera.h.

GLC_Camera & GLC_Camera::setTargetCam ( const GLC_Point3d Target  ) 

Set camera's target coordinate vector.

Definition at line 208 of file glc_camera.cpp.

References GLC_Vector3d::invert(), m_Eye, m_Target, m_VectUp, glc::PI, setCam(), and GLC_Vector3d::setLength().

Referenced by GLC_SetTargetMover::init().

void GLC_Camera::setTopView (  )  [inline]

Set the standard top view form this camera.

Definition at line 220 of file glc_camera.h.

GLC_Camera & GLC_Camera::setUpCam ( const GLC_Vector3d Up  ) 

Set camera's Up vector.

Definition at line 239 of file glc_camera.cpp.

References forward(), m_Eye, m_Target, m_VectUp, and setCam().

Referenced by GLC_TurnTableMover::init().

GLC_Vector3d GLC_Camera::sideVector (  )  const [inline]

Side camera vector.

Definition at line 91 of file glc_camera.h.

GLC_Point3d GLC_Camera::target ( void   )  const [inline]

Get camera's target coordinate point.

Definition at line 79 of file glc_camera.h.

Referenced by GLC_RepCrossMover::glDraw(), GLC_TsrMover::move(), GLC_Viewport::reframe(), and rotateAroundTarget().

GLC_Camera GLC_Camera::topView (  )  const

Return the standard top view form this camera.

Definition at line 373 of file glc_camera.cpp.

References distEyeTarget(), eye(), m_DefaultVectUp, m_Target, setDefaultUpVector(), setDistEyeTarget(), GLC_Vector3d::setVect(), and glc::Y_AXIS().

Referenced by bottomView().

GLC_Camera & GLC_Camera::translate ( const GLC_Vector3d VectTrans  ) 

Camera translation.

Definition at line 169 of file glc_camera.cpp.

References m_Eye, and m_Target.

Referenced by GLC_TsrMover::move(), GLC_Viewport::reframe(), and rotateAround().

GLC_Vector3d GLC_Camera::upVector ( void   )  const [inline]

Get camera's Up vector.

Definition at line 83 of file glc_camera.h.

Referenced by bottomView(), GLC_TurnTableMover::init(), and GLC_TurnTableMover::move().

GLC_Matrix4x4 GLC_Camera::viewMatrix ( void   )  const [inline]

Get camera's orbit composition matrix.

Definition at line 95 of file glc_camera.h.

Referenced by GLC_FlyMover::fly().

GLC_Camera & GLC_Camera::zoom ( double  factor  ) 

move camera's eye along camera vector (eye -> target)

Factor must be > 0

Definition at line 123 of file glc_camera.cpp.

References GLC_Vector3d::length(), m_Eye, m_Target, and GLC_Vector3d::setLength().

Referenced by GLC_ZoomMover::move(), and GLC_TsrMover::move().


Member Data Documentation

The default Up axis.

Definition at line 269 of file glc_camera.h.

Referenced by frontView(), isoView(), leftView(), operator=(), operator==(), rearView(), rightView(), and topView().

Camera model view matrix.

Definition at line 266 of file glc_camera.h.

Referenced by createMatComp(), operator=(), orbit(), pan(), and setCam().


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

SourceForge.net Logo

©2005-2011 Laurent Ribon