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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019