A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
This class has protected constuctor, thus it cannot be created by users. Use COpenGLScene::createViewport instead. A viewport has these "operation modes":
In any case, the viewport can be resized to only fit a part of the entire parent viewport. There will be always at least one viewport in a COpenGLScene named "main".
This class can be observed (see mrpt::utils::CObserver) for the following events (see mrpt::utils::mrptEvent):
Two directional light sources at infinity are created by default, with directions (-1,-1,-1) and (1,2,1), respectively. All OpenGL properties of light sources are accesible via the methods: setNumberOfLights(), lightsClearAll(), addLight(), and getLight(). Please, refer to mrpt::opengl::CLight and the standard OpenGL documentation for the meaning of all light properties.
Refer to mrpt::opengl::COpenGLScene for further details.
Definition at line 65 of file COpenGLViewport.h.
#include <mrpt/opengl/COpenGLViewport.h>
Classes | |
struct | TLastProjectiveMatrixInfo |
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) noexcept |
void | operator delete[] (void *ptr) noexcept |
void | operator delete (void *memory, void *ptr) noexcept |
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
virtual | ~COpenGLViewport () |
Destructor: clears all objects. More... | |
virtual mxArray * | writeToMatlab () const |
Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More... | |
Set the viewport "modes" | |
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. More... | |
void | setImageView (const mrpt::utils::CImage &img) |
Set this viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport area) using an OpenGL textured quad. More... | |
void | setImageView_fast (mrpt::utils::CImage &img) |
Just like setImageView but moves the internal image memory instead of making a copy, so it's faster but empties the input image. More... | |
void | resetCloneView () |
Reset the viewport to normal mode: rendering its own objects. More... | |
void | setCloneCamera (bool enable) |
If set to true, and setCloneView() has been called, this viewport will be rendered using the camera of the cloned viewport. More... | |
void | setNormalMode () |
Resets the viewport to a normal 3D viewport. More... | |
OpenGL global settings that affect rendering all objects in the | |
scene/viewport | |
void | enablePolygonNicest (bool enable=true) |
Sets glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) is enabled, or GL_FASTEST otherwise. More... | |
bool | isPolygonNicestEnabled () const |
void | lightsClearAll () |
Removes all lights (and disables the global "GL_LIGHTING") More... | |
void | addLight (const CLight &l) |
Append a new light to the scene. More... | |
void | setNumberOfLights (const size_t N) |
Allocates a number of lights, which must be correctly defined via getLight(i), etc. More... | |
CLight & | getLight (const size_t i) |
const CLight & | getLight (const size_t i) const |
Change or read viewport properties (except "viewport modes") | |
std::string | getName () |
Returns the name of the viewport. More... | |
void | setViewportPosition (const double x, const double y, const double width, const double height) |
Change the viewport position and dimension on the rendering window. More... | |
void | getViewportPosition (double &x, double &y, double &width, double &height) |
Get the current viewport position and dimension on the rendering window. More... | |
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) More... | |
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) More... | |
void | setBorderSize (unsigned int lineWidth) |
Set the border size ("frame") of the viewport (default=0). More... | |
bool | isTransparent () |
Return whether the viewport will be rendered transparent over previous viewports. More... | |
void | setTransparent (bool trans) |
Set the transparency, that is, whether the viewport will be rendered transparent over previous viewports (default=false). More... | |
void | setCustomBackgroundColor (const mrpt::utils::TColorf &color) |
Set a background color different from that of the parent GUI window. More... | |
mrpt::utils::TColorf | getCustomBackgroundColor () const |
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 select 3D objects by clicking onto the 2D image. More... | |
RTTI classes and functions | |
mrpt::utils::CObject::Ptr | duplicateGetSmartPtr () const |
Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More... | |
Static Public Member Functions | |
static void * | operator new (size_t size, void *ptr) |
Protected Member Functions | |
COpenGLViewport (COpenGLScene *parent=nullptr, const std::string &name=std::string("")) | |
Constructor, invoked from COpenGLScene only. More... | |
void | initializeAllTextures () |
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL) More... | |
void | dumpListOfObjects (mrpt::utils::CStringList &lst) |
Retrieves a list of all objects in text form. More... | |
void | render (const int render_width, const int render_height) const |
Render the objects in this viewport (called from COpenGLScene only) More... | |
void | internal_setImageView_fast (const mrpt::utils::CImage &img, bool is_fast) |
void | publishEvent (const mrptEvent &e) const |
Called when you want this object to emit an event to all the observers currently subscribed to this object. More... | |
bool | hasSubscribers () const |
Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read. More... | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const override |
Introduces a pure virtual method responsible for writing to a CStream. More... | |
void | readFromStream (mrpt::utils::CStream &in, int version) override |
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More... | |
Protected Attributes | |
opengl::CCamera | m_camera |
The camera associated to the viewport. More... | |
utils::safe_ptr< COpenGLScene > | m_parent |
The scene that contains this viewport. More... | |
bool | m_isCloned |
Set by setCloneView. More... | |
bool | m_isClonedCamera |
Set by setCloneCamera. More... | |
std::string | m_clonedViewport |
Only if m_isCloned=true. More... | |
std::string | m_name |
The viewport's name. More... | |
bool | m_isTransparent |
Whether to clear color buffer. More... | |
uint32_t | m_borderWidth |
Default=0, the border around the viewport. More... | |
double | m_view_x |
The viewport position [0,1]. More... | |
double | m_view_y |
double | m_view_width |
double | m_view_height |
double | m_clip_min |
The min/max clip depth distances (default: 0.1 - 10000) More... | |
double | m_clip_max |
bool | m_custom_backgb_color |
mrpt::utils::TColorf | m_background_color |
used only if m_custom_backgb_color More... | |
bool | m_isImageView |
Set by setImageView. More... | |
mrpt::utils::CImage::Ptr | m_imageview_img |
The image to display, after calling setImageView() More... | |
TLastProjectiveMatrixInfo | m_lastProjMat |
Info updated with each "render()" and used in "get3DRayForPixelCoord". More... | |
opengl::CListOpenGLObjects | m_objects |
The list of objects that comprise the 3D scene. More... | |
bool | m_OpenGL_enablePolygonNicest |
std::vector< CLight > | m_lights |
Friends | |
class | COpenGLScene |
RTTI stuff | |
using | Ptr = std::shared_ptr< COpenGLViewport > |
using | ConstPtr = std::shared_ptr< const COpenGLViewport > |
static mrpt::utils::CLASSINIT | _init_COpenGLViewport |
static const mrpt::utils::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "COpenGLViewport" |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
static const mrpt::utils::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static mrpt::utils::CObject * | CreateObject () |
template<typename... Args> | |
static Ptr | Create (Args &&... args) |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::utils::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
Contained objects set/get/search | |
typedef CListOpenGLObjects::const_iterator | const_iterator |
typedef CListOpenGLObjects::iterator | iterator |
const_iterator | begin () const |
const_iterator | end () const |
iterator | begin () |
iterator | end () |
void | clear () |
Delete all internal obejcts. More... | |
void | insert (const CRenderizable::Ptr &newObject) |
Insert a new object into the list. More... | |
void | getCurrentCameraPose (mrpt::poses::CPose3D &out_cameraPose) const |
Compute the current 3D camera pose. More... | |
CRenderizable::Ptr | getByName (const std::string &str) |
Returns the first object with a given name, or nullptr if not found. More... | |
template<typename T > | |
T::Ptr | getByClass (const size_t &ith=0) const |
Returns the i'th object of a given class (or of a descendant class), or nullptr (an empty smart pointer) if not found. More... | |
void | removeObject (const CRenderizable::Ptr &obj) |
Removes the given object from the scene (it also deletes the object to free its memory). More... | |
size_t | size () const |
Number of objects contained. More... | |
bool | empty () const |
opengl::CCamera & | getCamera () |
Get a reference to the camera associated with this viewport. More... | |
const opengl::CCamera & | getCamera () const |
Get a reference to the camera associated with this viewport. More... | |
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 the object parent. More... | |
typedef CListOpenGLObjects::const_iterator mrpt::opengl::COpenGLViewport::const_iterator |
Definition at line 258 of file COpenGLViewport.h.
using mrpt::opengl::COpenGLViewport::ConstPtr = std::shared_ptr<const COpenGLViewport > |
Definition at line 68 of file COpenGLViewport.h.
typedef CListOpenGLObjects::iterator mrpt::opengl::COpenGLViewport::iterator |
Definition at line 259 of file COpenGLViewport.h.
using mrpt::opengl::COpenGLViewport::Ptr = std::shared_ptr< COpenGLViewport > |
A typedef for the associated smart pointer
Definition at line 68 of file COpenGLViewport.h.
|
virtual |
Destructor: clears all objects.
Definition at line 98 of file COpenGLViewport.cpp.
References clear().
|
protected |
Constructor, invoked from COpenGLScene only.
Definition at line 51 of file COpenGLViewport.cpp.
References m_lights.
|
staticprotected |
Append a new light to the scene.
By default there are two lights. "GL_LIGHTING" is disabled if all lights are removed
Definition at line 131 of file COpenGLViewport.h.
References m_lights.
|
inline |
Definition at line 261 of file COpenGLViewport.h.
References m_objects.
|
inline |
Definition at line 263 of file COpenGLViewport.h.
References m_objects.
void COpenGLViewport::clear | ( | ) |
Delete all internal obejcts.
Definition at line 142 of file COpenGLViewport.cpp.
References m_objects.
Referenced by readFromStream(), setCloneView(), and ~COpenGLViewport().
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
inlinestatic |
Definition at line 68 of file COpenGLViewport.h.
|
static |
|
protected |
Retrieves a list of all objects in text form.
Definition at line 686 of file COpenGLViewport.cpp.
References mrpt::utils::CStringList::add(), CLASS_ID_NAMESPACE, m_objects, and mrpt::utils::CStringList::size().
|
inline |
Definition at line 329 of file COpenGLViewport.h.
References m_objects.
|
inline |
Sets glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) is enabled, or GL_FASTEST otherwise.
Definition at line 122 of file COpenGLViewport.h.
References m_OpenGL_enablePolygonNicest.
|
inline |
Definition at line 262 of file COpenGLViewport.h.
References m_objects.
|
inline |
Definition at line 264 of file COpenGLViewport.h.
References m_objects.
void COpenGLViewport::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 select 3D objects by clicking onto the 2D image.
x_coord | Horizontal coordinate with the usual meaning (0:left of the viewport, W-1: right border). |
y_coord | Horizontal coordinate with the usual meaning (0:top of the viewport, H-1: right border). |
out_cameraPose | If not nullptr, will have the camera 3D pose as a mrpt::poses::CPose3D. See also |
Definition at line 753 of file COpenGLViewport.cpp.
References ASSERTDEB_, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::azimuth, mrpt::math::crossProduct3D(), DEG2RAD, mrpt::math::TLine3D::director, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::elev, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::eye, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::FOV, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::is_projective, m_lastProjMat, mrpt::math::TLine3D::pBase, mrpt::math::UNINITIALIZED_MATRIX, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::viewport_height, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::viewport_width, mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, mrpt::math::TPoint3D::z, and mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::zoom.
void COpenGLViewport::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 the object parent.
Definition at line 925 of file COpenGLViewport.cpp.
References mrpt::utils::keep_max(), mrpt::utils::keep_min(), m_objects, mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.
|
inline |
Returns the i'th object of a given class (or of a descendant class), or nullptr (an empty smart pointer) if not found.
Example:
By default (ith=0), the first observation is returned.
Definition at line 293 of file COpenGLViewport.h.
References CLASS_ID_NAMESPACE, mrpt::opengl::CSetOfObjects::getByClass(), m_objects, MRPT_END, and MRPT_START.
Referenced by render().
CRenderizable::Ptr COpenGLViewport::getByName | ( | const std::string & | str | ) |
Returns the first object with a given name, or nullptr if not found.
Definition at line 648 of file COpenGLViewport.cpp.
References CLASS_ID_NAMESPACE, and m_objects.
|
inline |
Get a reference to the camera associated with this viewport.
Definition at line 331 of file COpenGLViewport.h.
References m_camera.
|
inline |
Get a reference to the camera associated with this viewport.
Definition at line 333 of file COpenGLViewport.h.
References m_camera.
void COpenGLViewport::getCurrentCameraPose | ( | mrpt::poses::CPose3D & | out_cameraPose | ) | const |
Compute the current 3D camera pose.
Definition at line 878 of file COpenGLViewport.cpp.
|
inline |
Definition at line 226 of file COpenGLViewport.h.
References m_background_color.
|
inline |
Definition at line 135 of file COpenGLViewport.h.
References ASSERT_BELOW_, and m_lights.
|
inline |
Definition at line 139 of file COpenGLViewport.h.
References ASSERT_BELOW_, and m_lights.
|
inline |
Returns the name of the viewport.
Definition at line 151 of file COpenGLViewport.h.
References m_name.
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
|
static |
void COpenGLViewport::getViewportClipDistances | ( | double & | clip_min, |
double & | clip_max | ||
) | const |
Get the current min/max clip depth distances of the rendering frustum (default: 0.1 - 10000)
Definition at line 743 of file COpenGLViewport.cpp.
References m_clip_max, and m_clip_min.
void COpenGLViewport::getViewportPosition | ( | double & | x, |
double & | y, | ||
double & | width, | ||
double & | height | ||
) |
Get the current viewport position and dimension on the rendering window.
X & Y coordinates here can have two interpretations:
Definition at line 130 of file COpenGLViewport.cpp.
References m_view_height, m_view_width, m_view_x, and m_view_y.
|
inlineprotectedinherited |
Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read.
Definition at line 57 of file CObservable.h.
References mrpt::utils::CObservable::m_subscribers.
Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), and render().
|
protected |
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
Definition at line 669 of file COpenGLViewport.cpp.
References IS_CLASS, IS_DERIVED, and m_objects.
void COpenGLViewport::insert | ( | const CRenderizable::Ptr & | newObject | ) |
Insert a new object into the list.
The object MUST NOT be deleted, it will be deleted automatically by this object when not required anymore.
Definition at line 146 of file COpenGLViewport.cpp.
References m_objects.
|
protected |
Definition at line 906 of file COpenGLViewport.cpp.
References mrpt::utils::CImage::copyFastFrom(), m_imageview_img, and m_isImageView.
Referenced by setImageView(), and setImageView_fast().
|
inline |
Definition at line 126 of file COpenGLViewport.h.
References m_OpenGL_enablePolygonNicest.
|
inline |
Return whether the viewport will be rendered transparent over previous viewports.
Definition at line 214 of file COpenGLViewport.h.
References m_isTransparent.
|
inline |
Removes all lights (and disables the global "GL_LIGHTING")
Definition at line 128 of file COpenGLViewport.h.
References m_lights.
Definition at line 68 of file COpenGLViewport.h.
|
inlinenoexcept |
Definition at line 68 of file COpenGLViewport.h.
Definition at line 68 of file COpenGLViewport.h.
Definition at line 68 of file COpenGLViewport.h.
|
inlinenoexcept |
Definition at line 68 of file COpenGLViewport.h.
Definition at line 68 of file COpenGLViewport.h.
|
inline |
Definition at line 68 of file COpenGLViewport.h.
|
inline |
Definition at line 68 of file COpenGLViewport.h.
Called when you want this object to emit an event to all the observers currently subscribed to this object.
Definition at line 47 of file CObservable.cpp.
References MRPT_END, and MRPT_START.
Referenced by mrpt::gui::CDisplayWindow3D::internal_emitGrabImageEvent(), mrpt::gui::CWindowDialog::OnChar(), mrpt::gui::CWindowDialog::OnClose(), mrpt::gui::C3DWindowDialog::OnClose(), mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), mrpt::gui::C3DWindowDialog::OnResize(), and render().
|
overrideprotectedvirtual |
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any error, see CStream::ReadBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 583 of file COpenGLViewport.cpp.
References mrpt::utils::TColorf::A, mrpt::utils::TColorf::B, clear(), mrpt::utils::TColorf::G, m_background_color, m_borderWidth, m_camera, m_clonedViewport, m_custom_backgb_color, m_isCloned, m_isClonedCamera, m_isTransparent, m_lights, m_name, m_objects, m_OpenGL_enablePolygonNicest, m_view_height, m_view_width, m_view_x, m_view_y, MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, and mrpt::utils::TColorf::R.
void COpenGLViewport::removeObject | ( | const CRenderizable::Ptr & | obj | ) |
Removes the given object from the scene (it also deletes the object to free its memory).
Definition at line 713 of file COpenGLViewport.cpp.
References CLASS_ID_NAMESPACE, and m_objects.
|
protected |
Render the objects in this viewport (called from COpenGLScene only)
Definition at line 154 of file COpenGLViewport.cpp.
References mrpt::utils::TColorf::A, ASSERT_, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::azimuth, mrpt::utils::TColorf::B, mrpt::opengl::CRenderizable::checkOpenGLError(), mrpt::utils::TRuntimeClassId::className, DEG2RAD, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::elev, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::eye, mrpt::format(), mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::FOV, mrpt::utils::TColorf::G, getByClass(), mrpt::poses::CPose3D::getRotationMatrix(), mrpt::opengl::CRenderizable::GetRuntimeClass(), GL_ACCUM_BUFFER_BIT, GL_AMBIENT_AND_DIFFUSE, GL_BGR, GL_COLOR_BUFFER_BIT, GL_COLOR_CLEAR_VALUE, GL_COLOR_MATERIAL, GL_DEPTH_BUFFER_BIT, GL_DEPTH_TEST, GL_FASTEST, GL_FRONT_AND_BACK, GL_LEQUAL, GL_LIGHT_MODEL_TWO_SIDE, GL_LIGHTING, GL_LINE_LOOP, GL_LUMINANCE, GL_MODELVIEW, GL_NICEST, GL_PERSPECTIVE_CORRECTION_HINT, GL_POLYGON_SMOOTH_HINT, GL_PROJECTION, GL_RGB, GL_SCISSOR_TEST, GL_SMOOTH, GL_STENCIL_BUFFER_BIT, GL_TRUE, GL_UNPACK_ROW_LENGTH, GL_UNSIGNED_BYTE, glBegin(), glClear(), glClearColor(), glColor4f(), glColorMaterial(), glDepthFunc(), glDisable(), glDrawPixels(), glEnable(), glEnd(), glGetDoublev(), glHint(), glLightModeli(), glLineWidth(), glLoadIdentity(), glMatrixMode(), glOrtho(), glPixelStorei(), glPixelZoom(), glRasterPos2f(), glScissor(), glShadeModel(), glVertex2f(), glViewport(), mrpt::utils::CObservable::hasSubscribers(), mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::is_projective, m_background_color, m_borderWidth, m_camera, m_clip_max, m_clip_min, m_clonedViewport, m_custom_backgb_color, mrpt::opengl::CCamera::m_distanceZoom, m_imageview_img, m_isCloned, m_isClonedCamera, m_isImageView, m_isTransparent, m_lastProjMat, m_lights, m_objects, m_OpenGL_enablePolygonNicest, m_parent, m_view_height, m_view_width, m_view_x, m_view_y, MRPT_UNUSED_PARAM, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::pointing, mrpt::utils::CObservable::publishEvent(), mrpt::utils::TColorf::R, mrpt::opengl::gl_utils::renderSetOfObjects(), THROW_EXCEPTION, THROW_EXCEPTION_FMT, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::up, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::viewport_height, mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::viewport_width, mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::x(), mrpt::math::TPoint3D::x, mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::y(), mrpt::math::TPoint3D::y, mrpt::math::TPoint3D::z, and mrpt::opengl::COpenGLViewport::TLastProjectiveMatrixInfo::zoom.
|
inline |
Reset the viewport to normal mode: rendering its own objects.
Definition at line 104 of file COpenGLViewport.h.
References setNormalMode().
|
inline |
Set the border size ("frame") of the viewport (default=0).
Definition at line 206 of file COpenGLViewport.h.
References m_borderWidth.
|
inline |
If set to true, and setCloneView() has been called, this viewport will be rendered using the camera of the cloned viewport.
Definition at line 108 of file COpenGLViewport.h.
References m_isClonedCamera.
void COpenGLViewport::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.
By default, only the objects are cloned, not the camera. See
Definition at line 102 of file COpenGLViewport.cpp.
References clear(), m_clonedViewport, and m_isCloned.
|
inline |
Set a background color different from that of the parent GUI window.
Definition at line 220 of file COpenGLViewport.h.
References m_background_color, and m_custom_backgb_color.
void COpenGLViewport::setImageView | ( | const mrpt::utils::CImage & | img | ) |
Set this viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport area) using an OpenGL textured quad.
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). Internally, the texture is drawn using a mrpt::opengl::CTexturedPlane The viewport can be reverted to behave like a normal viewport by calling setNormalMode()
Definition at line 897 of file COpenGLViewport.cpp.
References internal_setImageView_fast().
void COpenGLViewport::setImageView_fast | ( | mrpt::utils::CImage & | img | ) |
Just like setImageView but moves the internal image memory instead of making a copy, so it's faster but empties the input image.
Definition at line 901 of file COpenGLViewport.cpp.
References internal_setImageView_fast().
void COpenGLViewport::setNormalMode | ( | ) |
Resets the viewport to a normal 3D viewport.
Definition at line 887 of file COpenGLViewport.cpp.
References m_imageview_img, m_isCloned, m_isClonedCamera, and m_isImageView.
Referenced by resetCloneView().
|
inline |
Allocates a number of lights, which must be correctly defined via getLight(i), etc.
Definition at line 134 of file COpenGLViewport.h.
References m_lights.
|
inline |
Set the transparency, that is, whether the viewport will be rendered transparent over previous viewports (default=false).
Definition at line 218 of file COpenGLViewport.h.
References m_isTransparent.
void COpenGLViewport::setViewportClipDistances | ( | const double | clip_min, |
const double | clip_max | ||
) |
Set the min/max clip depth distances of the rendering frustum (default: 0.1 - 10000)
Definition at line 731 of file COpenGLViewport.cpp.
References ASSERT_, m_clip_max, and m_clip_min.
void COpenGLViewport::setViewportPosition | ( | const double | x, |
const double | y, | ||
const double | width, | ||
const double | height | ||
) |
Change the viewport position and dimension on the rendering window.
X & Y coordinates here can have two interpretations:
width & height can be interpreted as:
Definition at line 112 of file COpenGLViewport.cpp.
References ASSERT_, m_view_height, m_view_width, m_view_x, m_view_y, MRPT_END, and MRPT_START.
|
inline |
Number of objects contained.
Definition at line 328 of file COpenGLViewport.h.
References m_objects.
|
inlinevirtualinherited |
Introduces a pure virtual method responsible for writing to a mxArray
Matlab object, typically a MATLAB struct
whose contents are documented in each derived class.
mxArray
(caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB. Definition at line 89 of file CSerializable.h.
|
overrideprotectedvirtual |
Introduces a pure virtual method responsible for writing to a CStream.
This can not be used directly be users, instead use "stream << object;" for writing it to a stream.
out | The output binary stream where object must be dumped. |
getVersion | If nullptr, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data. |
std::exception | On any error, see CStream::WriteBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 546 of file COpenGLViewport.cpp.
References mrpt::utils::TColorf::A, mrpt::utils::TColorf::B, mrpt::utils::TColorf::G, m_background_color, m_borderWidth, m_camera, m_clonedViewport, m_custom_backgb_color, m_isCloned, m_isClonedCamera, m_isTransparent, m_lights, m_name, m_objects, m_OpenGL_enablePolygonNicest, m_view_height, m_view_width, m_view_x, m_view_y, and mrpt::utils::TColorf::R.
|
friend |
Definition at line 69 of file COpenGLViewport.h.
|
staticprotected |
Definition at line 68 of file COpenGLViewport.h.
|
static |
Definition at line 68 of file COpenGLViewport.h.
|
protected |
used only if m_custom_backgb_color
Definition at line 386 of file COpenGLViewport.h.
Referenced by getCustomBackgroundColor(), readFromStream(), render(), setCustomBackgroundColor(), and writeToStream().
|
protected |
Default=0, the border around the viewport.
Definition at line 379 of file COpenGLViewport.h.
Referenced by readFromStream(), render(), setBorderSize(), and writeToStream().
|
protected |
The camera associated to the viewport.
Definition at line 365 of file COpenGLViewport.h.
Referenced by getCamera(), readFromStream(), render(), and writeToStream().
|
protected |
Definition at line 383 of file COpenGLViewport.h.
Referenced by getViewportClipDistances(), render(), and setViewportClipDistances().
|
protected |
The min/max clip depth distances (default: 0.1 - 10000)
Definition at line 383 of file COpenGLViewport.h.
Referenced by getViewportClipDistances(), render(), and setViewportClipDistances().
|
protected |
Only if m_isCloned=true.
Definition at line 373 of file COpenGLViewport.h.
Referenced by readFromStream(), render(), setCloneView(), and writeToStream().
|
protected |
Definition at line 384 of file COpenGLViewport.h.
Referenced by readFromStream(), render(), setCustomBackgroundColor(), and writeToStream().
|
protected |
The image to display, after calling setImageView()
Definition at line 392 of file COpenGLViewport.h.
Referenced by internal_setImageView_fast(), render(), and setNormalMode().
|
protected |
Set by setCloneView.
Definition at line 369 of file COpenGLViewport.h.
Referenced by readFromStream(), render(), setCloneView(), setNormalMode(), and writeToStream().
|
protected |
Set by setCloneCamera.
Definition at line 371 of file COpenGLViewport.h.
Referenced by readFromStream(), render(), setCloneCamera(), setNormalMode(), and writeToStream().
|
protected |
Set by setImageView.
Definition at line 388 of file COpenGLViewport.h.
Referenced by internal_setImageView_fast(), render(), and setNormalMode().
|
protected |
Whether to clear color buffer.
Definition at line 377 of file COpenGLViewport.h.
Referenced by isTransparent(), readFromStream(), render(), setTransparent(), and writeToStream().
|
mutableprotected |
Info updated with each "render()" and used in "get3DRayForPixelCoord".
Definition at line 425 of file COpenGLViewport.h.
Referenced by get3DRayForPixelCoord(), and render().
|
protected |
Definition at line 439 of file COpenGLViewport.h.
Referenced by addLight(), COpenGLViewport(), getLight(), lightsClearAll(), readFromStream(), render(), setNumberOfLights(), and writeToStream().
|
protected |
The viewport's name.
Definition at line 375 of file COpenGLViewport.h.
Referenced by getName(), readFromStream(), and writeToStream().
|
protected |
The list of objects that comprise the 3D scene.
Objects are automatically deleted when calling "clear" or in the destructor.
Definition at line 431 of file COpenGLViewport.h.
Referenced by begin(), clear(), dumpListOfObjects(), empty(), end(), getBoundingBox(), getByClass(), getByName(), initializeAllTextures(), insert(), readFromStream(), removeObject(), render(), size(), and writeToStream().
|
protected |
Definition at line 437 of file COpenGLViewport.h.
Referenced by enablePolygonNicest(), isPolygonNicestEnabled(), readFromStream(), render(), and writeToStream().
|
protected |
The scene that contains this viewport.
Definition at line 367 of file COpenGLViewport.h.
Referenced by mrpt::opengl::COpenGLScene::readFromStream(), and render().
|
protected |
Definition at line 381 of file COpenGLViewport.h.
Referenced by getViewportPosition(), readFromStream(), render(), setViewportPosition(), and writeToStream().
|
protected |
Definition at line 381 of file COpenGLViewport.h.
Referenced by getViewportPosition(), readFromStream(), render(), setViewportPosition(), and writeToStream().
|
protected |
The viewport position [0,1].
Definition at line 381 of file COpenGLViewport.h.
Referenced by getViewportPosition(), readFromStream(), render(), setViewportPosition(), and writeToStream().
|
protected |
Definition at line 381 of file COpenGLViewport.h.
Referenced by getViewportPosition(), readFromStream(), render(), setViewportPosition(), and writeToStream().
|
staticprotected |
Definition at line 68 of file COpenGLViewport.h.
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 |