Main MRPT website > C++ reference for MRPT 1.4.0
CCamera.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9
10#ifndef opengl_CCamera_H
11#define opengl_CCamera_H
12
15
16namespace mrpt
17{
18 namespace opengl
19 {
20 class COpenGLViewport;
21 class CCamera;
22
23 // This must be added to any CSerializable derived class:
25
26 /** A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camera parameters set in COpenGLViewport::m_camera.
27 * A camera can be defined to provide a projective or orthogonal view of the world by setting the member CCamera::m_projectiveModel.
28 * \sa opengl::COpenGLScene
29 * \ingroup mrpt_opengl_grp
30 */
32 {
33 friend class COpenGLViewport;
34
36 protected:
37
38 float m_pointingX,m_pointingY,m_pointingZ;
40 float m_azimuthDeg,m_elevationDeg;
41
42 bool m_projectiveModel; //!< If set to true (default), camera model is projective, otherwise, it's orthogonal.
43 float m_projectiveFOVdeg; //!< Field-of-View in degs, only when projectiveModel=true (default=30 deg).
44 bool m_6DOFMode; //!< If set to true, camera pose is used when rendering the viewport
45
46
47 public:
48 void setPointingAt(float x,float y, float z) { m_pointingX=x; m_pointingY=y; m_pointingZ=z; }
49
50 template <class POSEORPOINT>
51 void setPointingAt(const POSEORPOINT &p)
52 {
53 m_pointingX=p.x();
54 m_pointingY=p.y();
55 m_pointingZ=p.is3DPoseOrPoint() ? p.m_coords[2] : 0;
56 }
57 inline void setPointingAt(const mrpt::math::TPoint3D &p) { setPointingAt(p.x,p.y,p.z); }
58
59
60 float getPointingAtX() const { return m_pointingX; }
61 float getPointingAtY() const { return m_pointingY; }
62 float getPointingAtZ() const { return m_pointingZ; }
63
64 void setZoomDistance(float z) { m_distanceZoom=z; }
65 float getZoomDistance() const { return m_distanceZoom; }
66
67 float getAzimuthDegrees() const { return m_azimuthDeg; }
68 float getElevationDegrees() const { return m_elevationDeg; }
69
70 void setAzimuthDegrees(float ang) { m_azimuthDeg=ang; }
71 void setElevationDegrees(float ang) { m_elevationDeg=ang; }
72
73 void setProjectiveModel(bool v=true) { m_projectiveModel=v; } //!< Enable/Disable projective mode (vs. orthogonal)
74 void setOrthogonal(bool v=true) { m_projectiveModel=!v; } //!< Enable/Disable orthogonal mode (vs. projective)
75
76 /** Set 6DOFMode, if enabled camera is set according to its pose (default=false).
77 * Conventionally, eye is set looking towards the positive direction of Z axis.
78 * Up is set as the Y axis.
79 * In this mode azimuth/elevation are ignored.
80 **/
81 void set6DOFMode(bool v) { m_6DOFMode=v; }
82
83 bool isProjective() const { return m_projectiveModel; }
84 bool isOrthogonal() const { return !m_projectiveModel; }
85 bool is6DOFMode() const { return m_6DOFMode; }
86
87 void setProjectiveFOVdeg(float ang) { m_projectiveFOVdeg=ang; } //!< Field-of-View in degs, only when projectiveModel=true (default=30 deg).
88 float getProjectiveFOVdeg() const { return m_projectiveFOVdeg; } //!< Field-of-View in degs, only when projectiveModel=true (default=30 deg).
89
90
91 /** Render does nothing here. */
92 void render() const MRPT_OVERRIDE { }
93
94 /** In this class, returns a fixed box (max,max,max), (-max,-max,-max). */
96
97 private:
98 /** Constructor
99 */
101
102 /** Private, virtual destructor: only can be deleted from smart pointers */
103 virtual ~CCamera() { }
104
105 };
107
108 } // end namespace opengl
109
110} // End of namespace
111
112
113#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition: CCamera.h:32
bool isOrthogonal() const
Definition: CCamera.h:84
float getProjectiveFOVdeg() const
Field-of-View in degs, only when projectiveModel=true (default=30 deg).
Definition: CCamera.h:88
float getAzimuthDegrees() const
Definition: CCamera.h:67
bool isProjective() const
Definition: CCamera.h:83
void setPointingAt(float x, float y, float z)
Definition: CCamera.h:48
bool is6DOFMode() const
Definition: CCamera.h:85
void setElevationDegrees(float ang)
Definition: CCamera.h:71
float getZoomDistance() const
Definition: CCamera.h:65
void setZoomDistance(float z)
Definition: CCamera.h:64
bool m_6DOFMode
If set to true, camera pose is used when rendering the viewport.
Definition: CCamera.h:44
void setPointingAt(const POSEORPOINT &p)
Definition: CCamera.h:51
CCamera()
Constructor.
float getPointingAtX() const
Definition: CCamera.h:60
void setProjectiveFOVdeg(float ang)
Field-of-View in degs, only when projectiveModel=true (default=30 deg).
Definition: CCamera.h:87
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
In this class, returns a fixed box (max,max,max), (-max,-max,-max).
void setProjectiveModel(bool v=true)
Enable/Disable projective mode (vs. orthogonal)
Definition: CCamera.h:73
void setOrthogonal(bool v=true)
Enable/Disable orthogonal mode (vs. projective)
Definition: CCamera.h:74
void set6DOFMode(bool v)
Set 6DOFMode, if enabled camera is set according to its pose (default=false).
Definition: CCamera.h:81
virtual ~CCamera()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CCamera.h:103
bool m_projectiveModel
If set to true (default), camera model is projective, otherwise, it's orthogonal.
Definition: CCamera.h:42
float getElevationDegrees() const
Definition: CCamera.h:68
void render() const MRPT_OVERRIDE
Render does nothing here.
Definition: CCamera.h:92
float getPointingAtZ() const
Definition: CCamera.h:62
void setPointingAt(const mrpt::math::TPoint3D &p)
Definition: CCamera.h:57
float m_projectiveFOVdeg
Field-of-View in degs, only when projectiveModel=true (default=30 deg).
Definition: CCamera.h:43
void setAzimuthDegrees(float ang)
Definition: CCamera.h:70
float getPointingAtY() const
Definition: CCamera.h:61
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
The base class of 3D objects that can be directly rendered through OpenGL.
Definition: CRenderizable.h:45
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Lightweight 3D point.
double z
X,Y,Z coordinates.



Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:47:55 UTC 2021