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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020