GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Private Member Functions | Private Attributes | List of all members
GLC_Camera Class Reference

GLC_Camera : OpenGL perpective viewpoint. More...

#include <glc_camera.h>

+ Inheritance diagram for GLC_Camera:

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.
 
- Public Member Functions inherited from GLC_Object
 GLC_Object (const QString &name=QString())
 Default constructor.
 
 GLC_Object (GLC_uint id, const QString &name=QString())
 Construct a GLC_Object with the given UID.
 
 GLC_Object (const GLC_Object &sourceObject)
 Construct a GLC_Object from the given GLC_Object.
 
virtual ~GLC_Object ()
 Virtual destructor.
 
GLC_uint id () const
 Return this object id.
 
const QString name () const
 Return this object name.
 
bool operator== (const GLC_Object &obj)
 Return true if this object is equal to the given object.
 
void setId (const GLC_uint id)
 Set this object Id.
 
void setName (const QString &name)
 Set this object Name.
 
GLC_Objectoperator= (const GLC_Object &)
 Set this object from the given object.
 

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.
 

Additional Inherited Members

- Protected Attributes inherited from GLC_Object
GLC_uint m_Uid
 The Unique ID of an GLC_Object.
 
QString m_Name
 Name of an GLC_Object.
 
QMutex m_Mutex
 GLC_Object Mutex.
 

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 35 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 46 of file glc_camera.cpp.

References createMatComp(), and setCam().

GLC_Camera::GLC_Camera ( const GLC_Camera cam)

Copy constructor.

Definition at line 59 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 397 of file glc_camera.cpp.

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

void GLC_Camera::createMatComp ( void  )
private
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
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 336 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 433 of file glc_camera.cpp.

References GLC_Context::current(), GLC_Context::glcMultMatrix(), and modelViewMatrix().

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 322 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 406 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 368 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(), glExecute(), 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 310 of file glc_camera.cpp.

References m_DefaultVectUp, m_Eye, m_ModelViewMatrix, m_Target, m_VectUp, and GLC_Object::operator=().

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

equality operator

Definition at line 75 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 110 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 357 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 363 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 151 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 162 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 ( GLC_Point3d  Eye,
GLC_Point3d  Target,
GLC_Vector3d  Up 
)

Set the camera.

Definition at line 253 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::setCam ( const GLC_Camera cam)

Set the camera by copying another camera.

Definition at line 281 of file glc_camera.cpp.

References m_Eye, m_ModelViewMatrix, m_Target, and m_VectUp.

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 292 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 300 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 178 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 209 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 240 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.

References normalize(), and GLC_Vector3d::normalize().

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::createCrossInstance(), 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 374 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 170 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 124 of file glc_camera.cpp.

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

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

Member Data Documentation

GLC_Vector3d GLC_Camera::m_DefaultVectUp
private

The default Up axis.

Definition at line 269 of file glc_camera.h.

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

GLC_Point3d GLC_Camera::m_Eye
private
GLC_Matrix4x4 GLC_Camera::m_ModelViewMatrix
private

Camera model view matrix.

Definition at line 266 of file glc_camera.h.

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

GLC_Point3d GLC_Camera::m_Target
private
GLC_Vector3d GLC_Camera::m_VectUp
private

Camera's Up vector.

Definition at line 263 of file glc_camera.h.

Referenced by createMatComp(), isAlmostEqualTo(), move(), operator=(), operator==(), orbit(), setCam(), setEyeCam(), setTargetCam(), and setUpCam().


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

©2005-2013 Laurent Ribon