GLC_Camera : OpenGL perpective viewpoint. More...
#include <glc_camera.h>
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_Camera & | orbit (GLC_Vector3d VectOldPoss, GLC_Vector3d VectCurPoss) |
| Camera orbiting. | |
| GLC_Camera & | pan (GLC_Vector3d VectDep) |
| panoramic movement | |
| GLC_Camera & | zoom (double factor) |
| move camera's eye along camera vector (eye -> target) | |
| GLC_Camera & | move (const GLC_Matrix4x4 &MatMove) |
| Move camera. | |
| GLC_Camera & | rotateAround (const GLC_Vector3d &, const double &, const GLC_Point3d &) |
| Rotate around an axis. | |
| GLC_Camera & | rotateAroundTarget (const GLC_Vector3d &, const double &) |
| Rotate around camera target. | |
| GLC_Camera & | translate (const GLC_Vector3d &VectTrans) |
| Camera translation. | |
| GLC_Camera & | setCam (GLC_Point3d Eye, GLC_Point3d Target, GLC_Vector3d Up) |
| Set the camera. | |
| GLC_Camera & | setCam (const GLC_Camera &) |
| Set the camera by copying another camera. | |
| GLC_Camera & | setEyeCam (const GLC_Point3d &Eye) |
| Set camera's eye coordinate vector. | |
| GLC_Camera & | setTargetCam (const GLC_Point3d &Target) |
| Set camera's target coordinate vector. | |
| GLC_Camera & | setUpCam (const GLC_Vector3d &Up) |
| Set camera's Up vector. | |
| GLC_Camera & | setDistEyeTarget (double Longueur) |
| Set the distance between eye and target (move eye). | |
| GLC_Camera & | setDistTargetEye (double Longueur) |
| Set the distance between target and eye (move target). | |
| GLC_Camera & | operator= (const GLC_Camera &) |
| Assignement operator. | |
| GLC_Camera & | setDefaultUpVector (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_MatCompOrbit |
| Camera orbit composition matrix. | |
| GLC_Vector3d | m_DefaultVectUp |
| The default Up axis. | |
GLC_Camera : OpenGL perpective viewpoint.
An GLC_Camera define Viewpoint and orientation of an OpenGL perpective camera
Definition at line 45 of file glc_camera.h.
| GLC_Camera::GLC_Camera | ( | ) |
Default constructor.
Point of view (0, 0, 1) Up Vector (0, 1, 0)
Definition at line 36 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 47 of file glc_camera.cpp.
References createMatComp(), and setCam().
| GLC_Camera::GLC_Camera | ( | const GLC_Camera & | cam | ) |
Copy constructor.
Definition at line 60 of file glc_camera.cpp.
| GLC_Camera GLC_Camera::bottomView | ( | ) | const |
Return the standard bottom view form this camera.
Definition at line 398 of file glc_camera.cpp.
References glc::PI, rotateAroundTarget(), topView(), and upVector().
| void GLC_Camera::createMatComp | ( | void | ) | [private] |
compute composition matrix
Definition at line 445 of file glc_camera.cpp.
References GLC_Matrix4x4::data(), forward(), m_Eye, m_MatCompOrbit, m_Target, m_VectUp, 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 107 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 73 of file glc_camera.h.
Referenced by frontView(), GLC_RepCrossMover::glDraw(), isoView(), GLC_Viewport::mapPosMouse(), GLC_Viewport::setDistMinAndMax(), topView(), and GLC_Viewport::updateProjectionMat().
| GLC_Point3d GLC_Camera::eye | ( | void | ) | const [inline] |
Get camera's eye coordinate point.
Definition at line 77 of file glc_camera.h.
Referenced by GLC_3DViewInstance::choseLod(), GLC_FlyMover::fly(), frontView(), GLC_FlyMover::init(), isoView(), GLC_AbstractManipulator::manipulate(), GLC_FlyMover::move(), GLC_Viewport::selectionFrustum(), GLC_Viewport::setDistMinAndMax(), and topView().
| GLC_Vector3d GLC_Camera::forward | ( | void | ) | const [inline] |
Get camera's forward vector (from eye to target).
Definition at line 89 of file glc_camera.h.
Referenced by createMatComp(), GLC_AbstractManipulator::enterManipulateState(), GLC_FlyMover::fly(), GLC_AbstractManipulator::manipulate(), GLC_TurnTableMover::move(), setDistEyeTarget(), setDistTargetEye(), setUpCam(), and GLC_FlyMover::timerEvent().
| GLC_Camera GLC_Camera::frontView | ( | ) | const |
Return the standard front view form this camera.
Definition at line 337 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 434 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 323 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 407 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 369 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 133 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 | ) |
Move camera.
Definition at line 141 of file glc_camera.cpp.
References createMatComp(), m_Eye, m_Target, m_VectUp, and GLC_Matrix4x4::rotationMatrix().
Referenced by GLC_FlyMover::fly(), rotateAround(), and GLC_FlyMover::timerEvent().
| GLC_Camera & GLC_Camera::operator= | ( | const GLC_Camera & | cam | ) |
Assignement operator.
Definition at line 311 of file glc_camera.cpp.
References m_DefaultVectUp, m_Eye, m_MatCompOrbit, m_Target, and m_VectUp.
| bool GLC_Camera::operator== | ( | const GLC_Camera & | cam | ) | const |
equality operator
Definition at line 76 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 | |||
| ) |
Camera orbiting.
Definition at line 86 of file glc_camera.cpp.
References createMatComp(), GLC_Matrix4x4::invert(), GLC_Vector3d::isNull(), m_Eye, m_MatCompOrbit, m_Target, and m_VectUp.
Referenced by GLC_TrackBallMover::move().
| GLC_Camera & GLC_Camera::pan | ( | GLC_Vector3d | VectDep | ) |
panoramic movement
Definition at line 111 of file glc_camera.cpp.
References GLC_Matrix4x4::invert(), m_Eye, m_MatCompOrbit, and m_Target.
Referenced by GLC_SetTargetMover::init(), and GLC_PanMover::move().
| GLC_Camera GLC_Camera::rearView | ( | ) | const |
Return the standard rear view form this camera.
Definition at line 358 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 364 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 152 of file glc_camera.cpp.
References move(), and translate().
Referenced by rotateAroundTarget().
| GLC_Camera & GLC_Camera::rotateAroundTarget | ( | const GLC_Vector3d & | axis, | |
| const double & | angle | |||
| ) |
Rotate around camera target.
Definition at line 163 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 226 of file glc_camera.h.
| GLC_Camera & GLC_Camera::setCam | ( | const GLC_Camera & | cam | ) |
Set the camera by copying another camera.
Definition at line 282 of file glc_camera.cpp.
References m_Eye, m_MatCompOrbit, 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 254 of file glc_camera.cpp.
References createMatComp(), m_Eye, m_Target, m_VectUp, 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 198 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 293 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 301 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 179 of file glc_camera.cpp.
References GLC_Vector3d::invert(), m_Eye, m_Target, m_VectUp, PI, setCam(), and GLC_Vector3d::setLength().
| void GLC_Camera::setFrontView | ( | ) | [inline] |
Set the standard front view form this camera.
Definition at line 206 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 231 of file glc_camera.h.
| void GLC_Camera::setLeftView | ( | ) | [inline] |
Set the standard left view form this camera.
Definition at line 218 of file glc_camera.h.
| void GLC_Camera::setRearView | ( | ) | [inline] |
Set the standard rear view form this camera.
Definition at line 210 of file glc_camera.h.
| void GLC_Camera::setRightView | ( | ) | [inline] |
Set the standard right view form this camera.
Definition at line 214 of file glc_camera.h.
| GLC_Camera & GLC_Camera::setTargetCam | ( | const GLC_Point3d & | Target | ) |
Set camera's target coordinate vector.
Definition at line 210 of file glc_camera.cpp.
References GLC_Vector3d::invert(), m_Eye, m_Target, m_VectUp, 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 222 of file glc_camera.h.
| GLC_Camera & GLC_Camera::setUpCam | ( | const GLC_Vector3d & | Up | ) |
Set camera's Up vector.
Definition at line 241 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 93 of file glc_camera.h.
Referenced by GLC_PullManipulator::doManipulate().
| GLC_Point3d GLC_Camera::target | ( | void | ) | const [inline] |
Get camera's target coordinate point.
Definition at line 81 of file glc_camera.h.
Referenced by GLC_RepCrossMover::glDraw(), GLC_Viewport::reframe(), and rotateAroundTarget().
| GLC_Camera GLC_Camera::topView | ( | ) | const |
Return the standard top view form this camera.
Definition at line 375 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 171 of file glc_camera.cpp.
References m_Eye, and m_Target.
Referenced by GLC_Viewport::reframe(), and rotateAround().
| GLC_Vector3d GLC_Camera::upVector | ( | void | ) | const [inline] |
Get camera's Up vector.
Definition at line 85 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 97 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 125 of file glc_camera.cpp.
References GLC_Vector3d::length(), m_Eye, m_Target, and GLC_Vector3d::setLength().
Referenced by GLC_ZoomMover::move().
GLC_Vector3d GLC_Camera::m_DefaultVectUp [private] |
The default Up axis.
Definition at line 271 of file glc_camera.h.
Referenced by frontView(), isoView(), leftView(), operator=(), operator==(), rearView(), rightView(), and topView().
GLC_Point3d GLC_Camera::m_Eye [private] |
Camera's eye point.
Definition at line 259 of file glc_camera.h.
Referenced by createMatComp(), glExecute(), isAlmostEqualTo(), move(), operator=(), operator==(), orbit(), pan(), setCam(), setDistEyeTarget(), setDistTargetEye(), setEyeCam(), setTargetCam(), setUpCam(), translate(), and zoom().
GLC_Matrix4x4 GLC_Camera::m_MatCompOrbit [private] |
Camera orbit composition matrix.
Definition at line 268 of file glc_camera.h.
Referenced by createMatComp(), operator=(), orbit(), pan(), and setCam().
GLC_Point3d GLC_Camera::m_Target [private] |
Camera's target point.
Definition at line 262 of file glc_camera.h.
Referenced by createMatComp(), frontView(), glExecute(), isAlmostEqualTo(), isoView(), move(), operator=(), operator==(), orbit(), pan(), rotateAroundTarget(), setCam(), setDistEyeTarget(), setDistTargetEye(), setEyeCam(), setTargetCam(), setUpCam(), topView(), translate(), and zoom().
GLC_Vector3d GLC_Camera::m_VectUp [private] |
Camera's Up vector.
Definition at line 265 of file glc_camera.h.
Referenced by createMatComp(), glExecute(), isAlmostEqualTo(), move(), operator=(), operator==(), orbit(), setCam(), setEyeCam(), setTargetCam(), and setUpCam().