Main MRPT website > C++ reference for MRPT 1.4.0
COpenGLViewport.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 #ifndef opengl_COpenGLViewport_H
10 #define opengl_COpenGLViewport_H
11 
14 #include <mrpt/utils/CImage.h>
15 #include <mrpt/opengl/CCamera.h>
17 #include <mrpt/opengl/CLight.h>
19 #include <mrpt/utils/CObservable.h>
20 #include <mrpt/utils/CStringList.h>
21 #include <mrpt/utils/mrptEvent.h>
22 
23 namespace mrpt
24 {
25  namespace utils { class CImage; }
26 
27  namespace opengl
28  {
29  class COpenGLScene;
30  class CRenderizable;
31 
32  // This must be added to any CSerializable derived class:
34 
35  /** A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
36  * This class has protected constuctor, thus it cannot be created by users. Use COpenGLScene::createViewport instead.
37  * A viewport has these "operation modes":
38  * - Normal (default): It renders the contained objects.
39  * - Cloned: It clones the objects from another viewport. See \a setCloneView()
40  * - Image mode: It renders an image (e.g. from a video stream) efficiently using a textued quad. See \a setImageView().
41  *
42  * In any case, the viewport can be resized to only fit a part of the entire parent viewport.
43  * There will be always at least one viewport in a COpenGLScene named "main".
44  *
45  * This class can be observed (see mrpt::utils::CObserver) for the following events (see mrpt::utils::mrptEvent):
46  * - mrpt::opengl::mrptEventGLPreRender
47  * - mrpt::opengl::mrptEventGLPostRender
48  *
49  * Two directional light sources at infinity are created by default, with directions (-1,-1,-1) and (1,2,1), respectively.
50  * All OpenGL properties of light sources are accesible via the methods: setNumberOfLights(), lightsClearAll(), addLight(), and getLight().
51  * Please, refer to mrpt::opengl::CLight and the standard OpenGL documentation for the meaning of all light properties.
52  *
53  * Refer to mrpt::opengl::COpenGLScene for further details.
54  * \ingroup mrpt_opengl_grp
55  */
57  public mrpt::utils::CSerializable,
58  public mrpt::utils::CObservable
59  {
61  friend class COpenGLScene;
62  public:
63  // -------------------------------------------------------------------
64  /** @name Set the viewport "modes"
65  @{ */
66 
67  /** Set this viewport as a clone of some other viewport, given its name - as a side effect, current list of internal OpenGL objects is cleared.
68  * By default, only the objects are cloned, not the camera. See
69  * \sa resetCloneView
70  */
71  void setCloneView( const std::string &clonedViewport );
72 
73  /** Set this viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport area) using an OpenGL textured quad.
74  * Call this method with the new image to update the displayed image (but recall to first lock the parent openglscene's critical section, then do the update, then release the lock, and then issue a window repaint).
75  * Internally, the texture is drawn using a mrpt::opengl::CTexturedPlane
76  * The viewport can be reverted to behave like a normal viewport by calling setNormalMode()
77  * \sa setImageView_fast
78  */
79  void setImageView(const mrpt::utils::CImage &img);
80 
81  /** Just like \a setImageView but moves the internal image memory instead of making a copy, so it's faster but empties the input image.
82  * \sa setImageView
83  */
84  void setImageView_fast(mrpt::utils::CImage &img);
85 
86  /** Reset the viewport to normal mode: rendering its own objects.
87  * \sa setCloneView, setNormalMode
88  */
89  inline void resetCloneView() { setNormalMode(); }
90 
91  /** If set to true, and setCloneView() has been called, this viewport will be rendered using the camera of the cloned viewport.
92  */
93  inline void setCloneCamera(bool enable) { m_isClonedCamera = enable; }
94 
95  /** Resets the viewport to a normal 3D viewport \sa setCloneView, setImageView */
96  void setNormalMode();
97 
98  /** @} */ // end of Set the "viewport mode"
99  // ------------------------------------------------------
100 
101 
102  /** @name OpenGL global settings that affect rendering all objects in the scene/viewport
103  @{ */
104 
105  /** Sets glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) is enabled, or GL_FASTEST otherwise. */
106  void enablePolygonNicest(bool enable=true) { m_OpenGL_enablePolygonNicest=enable; }
107  bool isPolygonNicestEnabled() const { return m_OpenGL_enablePolygonNicest; }
108 
109  /** Removes all lights (and disables the global "GL_LIGHTING") */
110  void lightsClearAll() { m_lights.clear(); }
111 
112  /** Append a new light to the scene. By default there are two lights. "GL_LIGHTING" is disabled if all lights are removed */
113  void addLight(const CLight &l) { m_lights.push_back(l); }
114 
115  /** Allocates a number of lights, which must be correctly defined via getLight(i), etc. */
116  void setNumberOfLights(const size_t N) { m_lights.resize(N); }
117 
118  CLight & getLight(const size_t i) { ASSERT_BELOW_(i,m_lights.size()) return m_lights[i]; }
119  const CLight & getLight(const size_t i) const { ASSERT_BELOW_(i,m_lights.size()) return m_lights[i]; }
120 
121  /** @} */ // end of OpenGL settings
122 
123  // -------------------------------------------------------------------
124  /** @name Change or read viewport properties (except "viewport modes")
125  @{ */
126 
127  /** Returns the name of the viewport */
128  inline std::string getName() { return m_name; }
129 
130  /** Change the viewport position and dimension on the rendering window.
131  * X & Y coordinates here can have two interpretations:
132  * - If in the range [0,1], they are factors with respect to the actual window sizes (i.e. width=1 means the entire width of the rendering window).
133  * - If >1, they are interpreted as pixels.
134  *
135  * width & height can be interpreted as:
136  * - If >1, they are the size of the viewport in that dimension, in pixels.
137  * - If in [0,1], they are the size of the viewport in that dimension, in a factor of the width/height.
138  * - If in [-1,0[, the size is computed such as the right/top border ends up in the given coordinate, interpreted as a factor (e.g. -1: up to the end of the viewport, -0.5: up to the middle of it).
139  * - If <-1 the size is computed such as the right/top border ends up in the given absolute coordinate (e.g. -200: up to the row/column 200px).
140  *
141  * \note (x,y) specify the lower left corner of the viewport rectangle.
142  * \sa getViewportPosition
143  */
144  void setViewportPosition(
145  const double x,
146  const double y,
147  const double width,
148  const double height );
149 
150  /** Get the current viewport position and dimension on the rendering window.
151  * X & Y coordinates here can have two interpretations:
152  * - If in the range [0,1], they are factors with respect to the actual window sizes (i.e. width=1 means the entire width of the rendering window).
153  * - If >1, they are interpreted as pixels.
154  * \note (x,y) specify the lower left corner of the viewport rectangle.
155  * \sa setViewportPosition
156  */
157  void getViewportPosition(
158  double &x,
159  double &y,
160  double &width,
161  double &height );
162 
163  /** Set the min/max clip depth distances of the rendering frustum (default: 0.1 - 10000)
164  * \sa getViewportClipDistances
165  */
166  void setViewportClipDistances(const double clip_min, const double clip_max);
167 
168  /** Get the current min/max clip depth distances of the rendering frustum (default: 0.1 - 10000)
169  * \sa setViewportClipDistances
170  */
171  void getViewportClipDistances(double &clip_min, double &clip_max) const;
172 
173  /** Set the border size ("frame") of the viewport (default=0).
174  */
175  inline void setBorderSize( unsigned int lineWidth ) { m_borderWidth = lineWidth; }
176 
177  /** Return whether the viewport will be rendered transparent over previous viewports.
178  */
179  inline bool isTransparent() { return m_isTransparent; }
180 
181  /** Set the transparency, that is, whether the viewport will be rendered transparent over previous viewports (default=false).
182  */
183  inline void setTransparent( bool trans ) { m_isTransparent=trans; }
184 
185  /** Set a background color different from that of the parent GUI window */
186  inline void setCustomBackgroundColor( const mrpt::utils::TColorf &color ) { m_custom_backgb_color = true; m_background_color = color; }
187 
188  inline mrpt::utils::TColorf getCustomBackgroundColor() const { return m_background_color; }
189 
190  /** Compute the 3D ray corresponding to a given pixel; this can be used to allow the user to pick and select 3D objects by clicking onto the 2D image.
191  * \param x_coord Horizontal coordinate with the usual meaning (0:left of the viewport, W-1: right border).
192  * \param y_coord Horizontal coordinate with the usual meaning (0:top of the viewport, H-1: right border).
193  * \param out_cameraPose If not NULL, will have the camera 3D pose as a mrpt::poses::CPose3D. See also
194  * \note (x,y) refer to VIEWPORT coordinates. Take into account this when viewports do not extend to the whole window size.
195  * \note x and y are double instead of integers to allow sub-pixel precision.
196  * \sa getCurrentCameraPose
197  */
198  void get3DRayForPixelCoord( const double x_coord, const double y_coord, mrpt::math::TLine3D &out_ray, mrpt::poses::CPose3D *out_cameraPose=NULL ) const;
199 
200  /** @} */ // end of Change or read viewport properties
201  // ------------------------------------------------------
202 
203 
204  // -------------------------------------------------------------------
205  /** @name Contained objects set/get/search
206  @{ */
207 
210 
211  inline const_iterator begin() const { return m_objects.begin(); }
212  inline const_iterator end() const { return m_objects.end(); }
213  inline iterator begin() { return m_objects.begin(); }
214  inline iterator end() { return m_objects.end(); }
215 
216  /** Delete all internal obejcts
217  * \sa insert */
218  void clear();
219 
220  /** Insert a new object into the list.
221  * The object MUST NOT be deleted, it will be deleted automatically by this object when not required anymore.
222  */
223  void insert( const CRenderizablePtr &newObject );
224 
225  /** Compute the current 3D camera pose.
226  * \sa get3DRayForPixelCoord
227  */
228  void getCurrentCameraPose( mrpt::poses::CPose3D &out_cameraPose ) const;
229 
230  /** Returns the first object with a given name, or NULL if not found.
231  */
232  CRenderizablePtr getByName( const std::string &str );
233 
234  /** Returns the i'th object of a given class (or of a descendant class), or NULL (an empty smart pointer) if not found.
235  * Example:
236  * \code
237  CSpherePtr obs = view.getByClass<CSphere>();
238  * \endcode
239  * By default (ith=0), the first observation is returned.
240  */
241  template <typename T>
242  typename T::SmartPtr getByClass( const size_t &ith = 0 ) const
243  {
244  MRPT_START
245  size_t foundCount = 0;
246  const mrpt::utils::TRuntimeClassId* class_ID = T::classinfo;
247  for (CListOpenGLObjects::const_iterator it = m_objects.begin();it!=m_objects.end();++it)
248  if ( (*it).present() && (*it)->GetRuntimeClass()->derivedFrom( class_ID ) )
249  if (foundCount++ == ith)
250  return typename T::SmartPtr(*it);
251 
252  // If not found directly, search recursively:
253  for (CListOpenGLObjects::const_iterator it=m_objects.begin();it!=m_objects.end();++it)
254  {
255  if ( (*it).present() && (*it)->GetRuntimeClass() == CLASS_ID_NAMESPACE(CSetOfObjects,mrpt::opengl))
256  {
257  typename T::SmartPtr o = CSetOfObjectsPtr(*it)->getByClass<T>(ith);
258  if (o.present()) return o;
259  }
260  }
261  return typename T::SmartPtr(); // Not found: return empty smart pointer
262  MRPT_END
263  }
264 
265  /** Removes the given object from the scene (it also deletes the object to free its memory).
266  */
267  void removeObject( const CRenderizablePtr & obj );
268 
269  /** Number of objects contained. */
270  inline size_t size() const { return m_objects.size(); }
271 
272  inline bool empty() const { return m_objects.empty(); }
273 
274  opengl::CCamera& getCamera() { return m_camera;} //!< Get a reference to the camera associated with this viewport.
275 
276  const opengl::CCamera & getCamera() const { return m_camera;} //!< Get a reference to the camera associated with this viewport.
277 
278  /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
279  void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const;
280 
281  /** @} */ // end of Contained objects set/get/search
282  // ------------------------------------------------------
283 
284 
285  virtual ~COpenGLViewport(); //!< Destructor: clears all objects.
286 
287 
288  protected:
289  /** Constructor, invoked from COpenGLScene only.
290  */
291  COpenGLViewport( COpenGLScene *parent=NULL, const std::string &name=std::string("") );
292 
293  /** Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
294  */
295  void initializeAllTextures();
296 
297  /** Retrieves a list of all objects in text form.
298  */
299  void dumpListOfObjects( mrpt::utils::CStringList &lst );
300 
301  /** Render the objects in this viewport (called from COpenGLScene only) */
302  void render( const int render_width, const int render_height ) const;
303 
304  /** The camera associated to the viewport */
306  utils::safe_ptr<COpenGLScene> m_parent; //!< The scene that contains this viewport.
307  bool m_isCloned; //!< Set by setCloneView
308  bool m_isClonedCamera; //!< Set by setCloneCamera
309  std::string m_clonedViewport; //!< Only if m_isCloned=true
310  std::string m_name; //!< The viewport's name
311  bool m_isTransparent; //!< Whether to clear color buffer.
312  uint32_t m_borderWidth; //!< Default=0, the border around the viewport.
313  double m_view_x, m_view_y,m_view_width,m_view_height; //!< The viewport position [0,1]
314  double m_clip_min,m_clip_max; //!< The min/max clip depth distances (default: 0.1 - 10000)
316  mrpt::utils::TColorf m_background_color; //!< used only if m_custom_backgb_color
317  bool m_isImageView; //!< Set by setImageView
318  //CRenderizablePtr m_imageview_quad ; //!< A mrpt::opengl::CTexturedPlane used after setImageView() is called
319  mrpt::utils::CImagePtr m_imageview_img; //!< The image to display, after calling \a setImageView()
320 
322  {
323  TLastProjectiveMatrixInfo() : eye(0,0,0),pointing(0,0,0),up(0,0,0), viewport_width(640), viewport_height(480), FOV(30), azimuth(0), elev(0), zoom(1),is_projective(true)
324  {}
325  mrpt::math::TPoint3D eye; //!< The camera is here.
326  mrpt::math::TPoint3D pointing; //!< The camera points to here
327  mrpt::math::TPoint3D up; //!< Up vector of the camera.
328  size_t viewport_width, viewport_height; //!< In pixels. This may be smaller than the total render window.
329  float FOV; //!< FOV in degrees.
330  float azimuth, elev; //!< Camera elev & azimuth, in radians.
331  float zoom;
332  bool is_projective; // true: projective, false: ortho
333  };
334  mutable TLastProjectiveMatrixInfo m_lastProjMat; //!< Info updated with each "render()" and used in "get3DRayForPixelCoord"
335 
336  /** The list of objects that comprise the 3D scene.
337  * Objects are automatically deleted when calling "clear" or in the destructor.
338  */
340 
341  void internal_setImageView_fast(const mrpt::utils::CImage &img, bool is_fast);
342 
343  // OpenGL global settings:
345 
346  std::vector<CLight> m_lights;
347  };
349  /**
350  * Inserts an openGL object into a viewport. Allows call chaining.
351  * \sa mrpt::opengl::COpenGLViewport::insert
352  */
353  inline COpenGLViewportPtr &operator<<(COpenGLViewportPtr &s,const CRenderizablePtr &r) {
354  s->insert(r);
355  return s;
356  }
357  /**
358  * Inserts any iterable set of openGL objects into a viewport. Allows call chaining.
359  * \sa mrpt::opengl::COpenGLViewport::insert
360  */
361  inline COpenGLViewportPtr &operator<<(COpenGLViewportPtr &s,const std::vector<CRenderizablePtr> &v) {
362  for (std::vector<CRenderizablePtr>::const_iterator it=v.begin();it!=v.end();++it) s->insert(*it);
363  return s;
364  }
365 
366 
367 
368  /** @name Events emitted by COpenGLViewport
369  @{ */
370 
371  /** An event sent by an mrpt::opengl::COpenGLViewport just after clearing the viewport and setting the GL_PROJECTION matrix, and before calling the scene OpenGL drawing primitives.
372  *
373  * While handling this event you can call OpenGL glBegin(),glEnd(),gl* functions or those in mrpt::opengl::gl_utils to draw stuff *in the back* of the normal
374  * objects contained in the COpenGLScene.
375  *
376  * After processing this event, COpenGLViewport will change the OpenGL matrix mode into "GL_MODELVIEW" and load an identity matrix to continue
377  * rendering the scene objects as usual. Any change done to the GL_PROJECTION will have effects, so do a glPushMatrix()/glPopMatrix() if that is not your intention.
378  *
379  *
380  * IMPORTANTE NOTICE: Event handlers in your observer class will most likely be invoked from an internal GUI thread of MRPT,
381  * so all your code in the handler must be thread safe.
382  */
384  {
385  protected:
386  void do_nothing() MRPT_OVERRIDE { } //!< Just to allow this class to be polymorphic
387  public:
388  inline mrptEventGLPreRender(const COpenGLViewport* obj) : source_viewport(obj) { }
390  }; // End of class def.
391 
392  /** An event sent by an mrpt::opengl::COpenGLViewport after calling the scene OpenGL drawing primitives and before doing a glSwapBuffers
393  *
394  * While handling this event you can call OpenGL glBegin(),glEnd(),gl* functions or those in mrpt::opengl::gl_utils to draw stuff *on the top* of the normal
395  * objects contained in the COpenGLScene.
396  *
397  * IMPORTANTE NOTICE: Event handlers in your observer class will most likely be invoked from an internal GUI thread of MRPT,
398  * so all your code in the handler must be thread safe.
399  */
401  {
402  protected:
403  void do_nothing() MRPT_OVERRIDE { } //!< Just to allow this class to be polymorphic
404  public:
405  inline mrptEventGLPostRender(const COpenGLViewport* obj) : source_viewport(obj) { }
407  }; // End of class def.
408 
409 
410  /** @} */
411 
412 
413 
414  } // end namespace
415 
416 } // End of namespace
417 
418 
419 #endif
mrpt::opengl::COpenGLViewport::empty
bool empty() const
Definition: COpenGLViewport.h:272
mrpt::utils::mrptEvent
The basic event type for the observer-observable pattern in MRPT.
Definition: mrptEvent.h:34
iterator
Scalar * iterator
Definition: eigen_plugins.h:23
mrpt::opengl::COpenGLViewport::getLight
const CLight & getLight(const size_t i) const
Definition: COpenGLViewport.h:119
mrpt::opengl::COpenGLViewport::size
size_t size() const
Number of objects contained.
Definition: COpenGLViewport.h:270
mrpt::opengl::COpenGLViewport::m_isImageView
bool m_isImageView
Set by setImageView.
Definition: COpenGLViewport.h:317
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::eye
mrpt::math::TPoint3D eye
The camera is here.
Definition: COpenGLViewport.h:325
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo
Definition: COpenGLViewport.h:321
mrpt::opengl::COpenGLViewport::m_lights
std::vector< CLight > m_lights
Definition: COpenGLViewport.h:346
CLight.h
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::FOV
float FOV
FOV in degrees.
Definition: COpenGLViewport.h:329
mrpt::opengl::COpenGLViewport::m_name
std::string m_name
The viewport's name.
Definition: COpenGLViewport.h:310
CCamera.h
mrpt::opengl::COpenGLViewport::isPolygonNicestEnabled
bool isPolygonNicestEnabled() const
Definition: COpenGLViewport.h:107
CSetOfObjects.h
mrpt::opengl::COpenGLScene
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
Definition: COpenGLScene.h:49
mrptEvent.h
mrpt::opengl::COpenGLViewport::addLight
void addLight(const CLight &l)
Append a new light to the scene.
Definition: COpenGLViewport.h:113
mrpt::opengl::COpenGLViewport::setBorderSize
void setBorderSize(unsigned int lineWidth)
Set the border size ("frame") of the viewport (default=0).
Definition: COpenGLViewport.h:175
mrpt::opengl::mrptEventGLPostRender
An event sent by an mrpt::opengl::COpenGLViewport after calling the scene OpenGL drawing primitives a...
Definition: COpenGLViewport.h:400
mrpt::opengl::COpenGLViewport::m_camera
opengl::CCamera m_camera
The camera associated to the viewport.
Definition: COpenGLViewport.h:305
mrpt::opengl::COpenGLViewport::m_borderWidth
uint32_t m_borderWidth
Default=0, the border around the viewport.
Definition: COpenGLViewport.h:312
mrpt::opengl::COpenGLViewport::end
iterator end()
Definition: COpenGLViewport.h:214
mrpt::opengl::COpenGLViewport::m_custom_backgb_color
bool m_custom_backgb_color
Definition: COpenGLViewport.h:315
mrpt::opengl::COpenGLViewport::iterator
CListOpenGLObjects::iterator iterator
Definition: COpenGLViewport.h:209
mrpt::opengl::COpenGLViewport::end
const_iterator end() const
Definition: COpenGLViewport.h:212
mrpt::opengl::COpenGLViewport::getLight
CLight & getLight(const size_t i)
Definition: COpenGLViewport.h:118
mrpt::opengl::COpenGLViewport::m_clip_min
double m_clip_min
Definition: COpenGLViewport.h:314
mrpt::opengl::CLight
Each of the possible lights of a 3D scene.
Definition: CLight.h:28
mrpt::opengl::CListOpenGLObjects
std::deque< CRenderizablePtr > CListOpenGLObjects
A list of objects pointers, automatically managing memory free at destructor, and managing copies cor...
Definition: CRenderizable.h:33
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::opengl::COpenGLViewport::m_imageview_img
mrpt::utils::CImagePtr m_imageview_img
The image to display, after calling setImageView()
Definition: COpenGLViewport.h:319
const_iterator
const typedef Scalar * const_iterator
Definition: eigen_plugins.h:24
mrpt::opengl::COpenGLViewport::getCustomBackgroundColor
mrpt::utils::TColorf getCustomBackgroundColor() const
Definition: COpenGLViewport.h:188
mrpt::utils::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:101
MRPT_END
#define MRPT_END
Definition: mrpt_macros.h:353
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::is_projective
bool is_projective
Definition: COpenGLViewport.h:332
ASSERT_BELOW_
#define ASSERT_BELOW_(__A, __B)
Definition: mrpt_macros.h:266
mrpt::opengl::COpenGLViewport::m_parent
utils::safe_ptr< COpenGLScene > m_parent
The scene that contains this viewport.
Definition: COpenGLViewport.h:306
mrpt::opengl::COpenGLViewport::lightsClearAll
void lightsClearAll()
Removes all lights (and disables the global "GL_LIGHTING")
Definition: COpenGLViewport.h:110
mrpt::opengl::mrptEventGLPostRender::mrptEventGLPostRender
mrptEventGLPostRender(const COpenGLViewport *obj)
Definition: COpenGLViewport.h:405
lightweight_geom_data.h
mrpt::opengl::COpenGLViewport::m_isCloned
bool m_isCloned
Set by setCloneView.
Definition: COpenGLViewport.h:307
mrpt::obs::gnss::azimuth
double azimuth
Definition: gnss_messages_novatel.h:204
mrpt::opengl::COpenGLViewport::m_view_y
double m_view_y
Definition: COpenGLViewport.h:313
mrpt::opengl::COpenGLViewport::begin
iterator begin()
Definition: COpenGLViewport.h:213
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::pointing
mrpt::math::TPoint3D pointing
The camera points to here.
Definition: COpenGLViewport.h:326
mrpt::opengl::COpenGLViewport::m_lastProjMat
TLastProjectiveMatrixInfo m_lastProjMat
Info updated with each "render()" and used in "get3DRayForPixelCoord".
Definition: COpenGLViewport.h:334
mrpt::opengl::CSetOfObjects
A set of object, which are referenced to the coordinates framework established in this object.
Definition: CSetOfObjects.h:32
mrpt::opengl::mrptEventGLPreRender
An event sent by an mrpt::opengl::COpenGLViewport just after clearing the viewport and setting the GL...
Definition: COpenGLViewport.h:383
mrpt::opengl::mrptEventGLPostRender::source_viewport
const COpenGLViewport *const source_viewport
Definition: COpenGLViewport.h:406
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::viewport_width
size_t viewport_width
Definition: COpenGLViewport.h:328
MRPT_START
#define MRPT_START
Definition: mrpt_macros.h:349
mrpt::opengl::COpenGLViewport::setTransparent
void setTransparent(bool trans)
Set the transparency, that is, whether the viewport will be rendered transparent over previous viewpo...
Definition: COpenGLViewport.h:183
mrpt::opengl::COpenGLViewport::m_objects
opengl::CListOpenGLObjects m_objects
The list of objects that comprise the 3D scene.
Definition: COpenGLViewport.h:339
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::up
mrpt::math::TPoint3D up
Up vector of the camera.
Definition: COpenGLViewport.h:327
mrpt::opengl::COpenGLViewport::setCustomBackgroundColor
void setCustomBackgroundColor(const mrpt::utils::TColorf &color)
Set a background color different from that of the parent GUI window.
Definition: COpenGLViewport.h:186
CObservable.h
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::TLastProjectiveMatrixInfo
TLastProjectiveMatrixInfo()
Definition: COpenGLViewport.h:323
mrpt::opengl::COpenGLViewport::getByClass
T::SmartPtr getByClass(const size_t &ith=0) const
Returns the i'th object of a given class (or of a descendant class), or NULL (an empty smart pointer)...
Definition: COpenGLViewport.h:242
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:72
mrpt::opengl::COpenGLViewport::getName
std::string getName()
Returns the name of the viewport.
Definition: COpenGLViewport.h:128
DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
Definition: CSerializable.h:174
mrpt::opengl::mrptEventGLPreRender::mrptEventGLPreRender
mrptEventGLPreRender(const COpenGLViewport *obj)
Definition: COpenGLViewport.h:388
mrpt::opengl::CCamera
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition: CCamera.h:31
CLASS_ID_NAMESPACE
#define CLASS_ID_NAMESPACE(class_name, namespaceName)
Access to runtime class ID for a defined class name.
Definition: CObject.h:92
mrpt::opengl::COpenGLViewport::const_iterator
CListOpenGLObjects::const_iterator const_iterator
Definition: COpenGLViewport.h:208
mrpt::opengl::COpenGLViewport::begin
const_iterator begin() const
Definition: COpenGLViewport.h:211
mrpt::opengl::COpenGLViewport::enablePolygonNicest
void enablePolygonNicest(bool enable=true)
Sets glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) is enabled, or GL_FASTEST otherwise.
Definition: COpenGLViewport.h:106
mrpt::utils::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:39
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:229
mrpt::opengl::COpenGLViewport::m_clonedViewport
std::string m_clonedViewport
Only if m_isCloned=true.
Definition: COpenGLViewport.h:309
mrpt::opengl::operator<<
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
mrpt::opengl::COpenGLViewport::m_isClonedCamera
bool m_isClonedCamera
Set by setCloneCamera.
Definition: COpenGLViewport.h:308
mrpt::utils::TColorf
A RGB color - floats in the range [0,1].
Definition: TColor.h:52
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE
#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...
Definition: CSerializable.h:170
eye
EIGEN_STRONG_INLINE void eye()
Make the matrix an identity matrix
Definition: eigen_plugins.h:63
mrpt::opengl::COpenGLViewport::m_isTransparent
bool m_isTransparent
Whether to clear color buffer.
Definition: COpenGLViewport.h:311
safe_pointers.h
CImage.h
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::elev
float elev
Camera elev & azimuth, in radians.
Definition: COpenGLViewport.h:330
mrpt::opengl::mrptEventGLPreRender::source_viewport
const COpenGLViewport *const source_viewport
Definition: COpenGLViewport.h:389
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:147
mrpt::opengl::COpenGLViewport::m_OpenGL_enablePolygonNicest
bool m_OpenGL_enablePolygonNicest
Definition: COpenGLViewport.h:344
mrpt::opengl::COpenGLViewport
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
Definition: COpenGLViewport.h:56
mrpt::utils::safe_ptr
A wrapper class for pointers that can be safely copied with "=" operator without problems.
Definition: safe_pointers.h:64
mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::zoom
float zoom
Definition: COpenGLViewport.h:331
mrpt::opengl::COpenGLViewport::m_background_color
mrpt::utils::TColorf m_background_color
used only if m_custom_backgb_color
Definition: COpenGLViewport.h:316
mrpt::opengl::COpenGLViewport::setCloneCamera
void setCloneCamera(bool enable)
If set to true, and setCloneView() has been called, this viewport will be rendered using the camera o...
Definition: COpenGLViewport.h:93
mrpt::math::TLine3D
3D line, represented by a base point and a director vector.
Definition: lightweight_geom_data.h:803
CStringList.h
mrpt::utils::CStringList
A class for storing a list of text lines.
Definition: CStringList.h:32
CSerializable.h
mrpt::utils::TRuntimeClassId
A structure that holds runtime class type information.
Definition: CObject.h:46
mrpt::opengl
The namespace for 3D scene representation and rendering.
Definition: CAngularObservationMesh.h:23
mrpt::opengl::COpenGLViewport::isTransparent
bool isTransparent()
Return whether the viewport will be rendered transparent over previous viewports.
Definition: COpenGLViewport.h:179
MRPT_OVERRIDE
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
mrpt::opengl::COpenGLViewport::setNumberOfLights
void setNumberOfLights(const size_t N)
Allocates a number of lights, which must be correctly defined via getLight(i), etc.
Definition: COpenGLViewport.h:116



Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Tue Mar 3 09:15:16 UTC 2020