MRPT  1.9.9
mrpt::gui::CDisplayWindow3D Class Reference

Detailed Description

A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.

This class always contains internally an instance of opengl::COpenGLScene, which the objects, viewports, etc. to be rendered.

Images can be grabbed automatically to disk for easy creation of videos. See CDisplayWindow3D::grabImagesStart (and for creating videos, mrpt::vision::CVideoFileWriter).

A short-cut for displaying 2D images (using the OpenGL rendering hardware) is available through setImageView() and setImageView_fast(). Internally, these methods call methods in the "main" viewport of the window (see COpenGLViewport).

Since the 3D rendering is performed in a detached thread, especial care must be taken when updating the 3D scene to be rendered. The process involves an internal critical section and it must always consist of these steps:

// Adquire the scene:
mrpt::opengl::COpenGLScene::Ptr &ptrScene = win.get3DSceneAndLock();
// Modify the scene:
ptrScene->...
// or replace by another scene:
ptrScene = otherScene;
// Unlock it, so the window can use it for redraw:
win.unlockAccess3DScene();
// Update window, if required
win.forceRepaint();

An alternative way of updating the scene is by creating, before locking the 3D window, a new object of class COpenGLScene, then locking the window only for replacing the smart pointer. This may be advantageous is generating the 3D scene takes a long time, since while the window is locked it will not be responsive to the user input or window redraw.

It is safer against exceptions to use the auxiliary class CDisplayWindow3DLocker.

// ...
{ // The scene is adquired in this scope
//...
} // scene is unlocked upon dtor of `locker`

Notice however that a copy of the smart pointer is made, so replacement of the entire scene via operator = is not possible if using this method. Still, in general it should be preferred because the mutexes are automatically released in case of unexpected exceptions.

The window can also display a set of 2D text messages overlapped to the 3D scene. See CDisplayWindow3D::addTextMessage

For a list of supported events with the observer/observable pattern, see the discussion in mrpt::gui::CBaseGUIWindow. In addition to those events, this class introduces mrpt::gui::mrptEvent3DWindowGrabImageFile

** CDisplayWindow3D mouse view navigation cheatsheet **

  • Orbit camera: Left-button pressed + move
  • Zoom in / out:
    • Mouse scroll wheel, or
    • SHIFT+Left-button pressed + move up/down
  • Look around (pivot camera): CTRL+Left-button pressed + move up/down
  • Pan (XY plane): Right-button pressed + move
  • Move camera along Z axis: SHIFT+Left-button pressed + move left/right
See also
The example /samples/display3D, the tutorial only.

Definition at line 116 of file CDisplayWindow3D.h.

#include <mrpt/gui/CDisplayWindow3D.h>

Inheritance diagram for mrpt::gui::CDisplayWindow3D:
Inheritance graph

Public Types

using Ptr = std::shared_ptr< CDisplayWindow3D >
 
using ConstPtr = std::shared_ptr< const CDisplayWindow3D >
 

Public Member Functions

 CDisplayWindow3D (const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
 Constructor. More...
 
virtual ~CDisplayWindow3D ()
 Destructor. More...
 
mrpt::opengl::COpenGLScene::Ptrget3DSceneAndLock ()
 Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!) This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked. More...
 
void unlockAccess3DScene ()
 Unlocks the access to the internal 3D scene. More...
 
void forceRepaint ()
 Repaints the window. More...
 
void repaint ()
 Repaints the window. More...
 
void updateWindow ()
 Repaints the window. More...
 
float getFOV () const
 Return the camera field of view (in degrees) (used for gluPerspective) More...
 
void setMinRange (double new_min)
 Changes the camera min clip range (z) (used for gluPerspective). More...
 
void setMaxRange (double new_max)
 Changes the camera max clip range (z) (used for gluPerspective. More...
 
void setFOV (float v)
 Changes the camera field of view (in degrees) (used for gluPerspective). More...
 
void resize (unsigned int width, unsigned int height) override
 Resizes the window, stretching the image to fit into the display area. More...
 
void setPos (int x, int y) override
 Changes the position of the window on the screen. More...
 
void setWindowTitle (const std::string &str) override
 Changes the window title. More...
 
void setCameraElevationDeg (float deg)
 Changes the camera parameters programmatically. More...
 
void setCameraAzimuthDeg (float deg)
 Changes the camera parameters programmatically. More...
 
void setCameraPointingToPoint (float x, float y, float z)
 Changes the camera parameters programmatically. More...
 
void setCameraZoom (float zoom)
 Changes the camera parameters programmatically. More...
 
void setCameraProjective (bool isProjective)
 Sets the camera as projective, or orthogonal. More...
 
float getCameraElevationDeg () const
 Get camera parameters programmatically. More...
 
float getCameraAzimuthDeg () const
 Get camera parameters programmatically. More...
 
void getCameraPointingToPoint (float &x, float &y, float &z) const
 Get camera parameters programmatically. More...
 
float getCameraZoom () const
 Get camera parameters programmatically. More...
 
bool isCameraProjective () const
 Sets the camera as projective, or orthogonal. More...
 
void useCameraFromScene (bool useIt=true)
 If set to true (default = false), the mouse-based scene navigation will be disabled and the camera position will be determined by the opengl viewports in the 3D scene. More...
 
bool getLastMousePositionRay (mrpt::math::TLine3D &ray) const
 Gets the 3D ray for the direction line of the pixel where the mouse cursor is at. More...
 
virtual bool getLastMousePosition (int &x, int &y) const override
 Gets the last x,y pixel coordinates of the mouse. More...
 
virtual void setCursorCross (bool cursorIsCross) override
 Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) More...
 
void grabImagesStart (const std::string &grab_imgs_prefix=std::string("video_"))
 Start to save rendered images to disk. More...
 
void grabImagesStop ()
 Stops image grabbing started by grabImagesStart. More...
 
void captureImagesStart ()
 Enables the grabbing of CImage objects from screenshots of the window. More...
 
void captureImagesStop ()
 Stop image grabbing. More...
 
bool getLastWindowImage (mrpt::img::CImage &out_img) const
 Retrieve the last captured image from the window. More...
 
mrpt::img::CImage::Ptr getLastWindowImagePtr () const
 Retrieve the last captured image from the window, as a smart pointer. More...
 
std::string grabImageGetNextFile ()
 Increments by one the image counter and return the next image file name (Users normally don't want to call this method). More...
 
bool isCapturingImgs () const
 
void addTextMessage (const double x, const double y, const std::string &text, const mrpt::img::TColorf &color=mrpt::img::TColorf(1.0, 1.0, 1.0), const size_t unique_index=0, const mrpt::opengl::TOpenGLFont font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24)
 Add 2D text messages overlapped to the 3D rendered scene. More...
 
void addTextMessage (const double x_frac, const double y_frac, const std::string &text, const mrpt::img::TColorf &color, const std::string &font_name, const double font_size, const mrpt::opengl::TOpenGLFontStyle font_style=mrpt::opengl::NICE, const size_t unique_index=0, const double font_spacing=1.5, const double font_kerning=0.1, const bool draw_shadow=false, const mrpt::img::TColorf &shadow_color=mrpt::img::TColorf(0, 0, 0))
 overload with more font parameters - refer to mrpt::opengl::gl_utils::glDrawText() Available fonts are enumerated at mrpt::opengl::gl_utils::glSetFont() More...
 
void clearTextMessages ()
 Clear all text messages created with addTextMessage(). More...
 
double getRenderingFPS () const
 Get the average Frames Per Second (FPS) value from the last 250 rendering events. More...
 
mrpt::opengl::COpenGLViewport::Ptr getDefaultViewport ()
 A short cut for getting the "main" viewport of the scene object, it is equivalent to: More...
 
void setImageView (const mrpt::img::CImage &img)
 Set the "main" 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::img::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...
 
voidgetWxObject ()
 Read-only access to the wxDialog object. More...
 
void notifyChildWindowDestruction ()
 Called by wx main thread to set m_hwnd to NULL. More...
 
void notifySemThreadReady ()
 Called by wx main thread to signal the semaphore that the wx window is built and ready. More...
 
bool isOpen ()
 Returns false if the user has already closed the window. More...
 
int waitForKey (bool ignoreControlKeys=true, mrptKeyModifier *out_pushModifier=nullptr)
 Waits for any key to be pushed on the image or the console, and returns the key code. More...
 
bool keyHit () const
 Returns true if a key has been pushed, without blocking waiting for a new key being pushed. More...
 
void clearKeyHitFlag ()
 Assure that "keyHit" will return false until the next pushed key. More...
 
int getPushedKey (mrptKeyModifier *out_pushModifier=nullptr)
 Returns the latest pushed key, or 0 if there is no new key stroke. More...
 

Static Public Member Functions

static CDisplayWindow3D::Ptr Create (const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
 Class factory returning a smart pointer. More...
 

Protected Member Functions

void createOpenGLContext ()
 Throws an exception on initialization error. More...
 
void doRender ()
 
void internalSetMinMaxRange ()
 
void internal_setRenderingFPS (double FPS)
 Set the rendering FPS (users don't call this, the method is for internal MRPT objects only) More...
 
void internal_emitGrabImageEvent (const std::string &fil)
 called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers More...
 
void createWxWindow (unsigned int initialWidth, unsigned int initialHeight)
 Must be called by child classes just within the constructor. More...
 
void destroyWxWindow ()
 Must be called by child classes in their destructors. More...
 
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...
 

Protected Attributes

mrpt::opengl::COpenGLScene::Ptr m_3Dscene
 Internal OpenGL object (see general discussion in about usage of this object) More...
 
std::recursive_mutex m_csAccess3DScene
 Critical section for accesing m_3Dscene. More...
 
mrpt::void_ptr_noncopy m_DisplayDeviceContext
 
mrpt::void_ptr_noncopy m_GLRenderingContext
 
std::string m_grab_imgs_prefix
 
unsigned int m_grab_imgs_idx
 
bool m_is_capturing_imgs
 
mrpt::img::CImage::Ptr m_last_captured_img
 
std::mutex m_last_captured_img_cs
 
mrpt::system::TTimeStamp m_lastFullScreen
 
double m_last_FPS
 
std::promise< voidm_threadReady
 This semaphore will be signaled when the wx window is built and ready. More...
 
std::promise< voidm_windowDestroyed
 This semaphore will be signaled when the wx window is destroyed. More...
 
std::string m_caption
 The caption of the window. More...
 
mrpt::void_ptr_noncopy m_hwnd
 The window handle. More...
 
volatile bool m_keyPushed
 
volatile int m_keyPushedCode
 
volatile mrptKeyModifier m_keyPushedModifier
 

Friends

class C3DWindowDialog
 
class CMyGLCanvas_DisplayWindow3D
 

Member Typedef Documentation

◆ ConstPtr

◆ Ptr

Constructor & Destructor Documentation

◆ CDisplayWindow3D()

CDisplayWindow3D::CDisplayWindow3D ( const std::string windowCaption = std::string(),
unsigned int  initialWindowWidth = 400,
unsigned int  initialWindowHeight = 300 
)

Constructor.

Definition at line 427 of file CDisplayWindow3D.cpp.

References mrpt::gui::CBaseGUIWindow::createWxWindow(), and m_3Dscene.

Referenced by Create().

◆ ~CDisplayWindow3D()

CDisplayWindow3D::~CDisplayWindow3D ( )
virtual

Destructor.

Definition at line 454 of file CDisplayWindow3D.cpp.

References mrpt::gui::CBaseGUIWindow::destroyWxWindow(), and m_csAccess3DScene.

Member Function Documentation

◆ addTextMessage() [1/2]

void CDisplayWindow3D::addTextMessage ( const double  x,
const double  y,
const std::string text,
const mrpt::img::TColorf color = mrpt::img::TColorf(1.0, 1.0, 1.0),
const size_t  unique_index = 0,
const mrpt::opengl::TOpenGLFont  font = mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24 
)

Add 2D text messages overlapped to the 3D rendered scene.

The string will remain displayed in the 3D window until it's changed with subsequent calls to this same method, or all the texts are cleared with clearTextMessages().

Parameters
xThe X position, interpreted as absolute pixels from the left if X>=1, absolute pixels from the left if X<0 or as a width factor if in the range [0,1[.
yThe Y position, interpreted as absolute pixels from the bottom if Y>=1, absolute pixels from the top if Y<0 or as a height factor if in the range [0,1[.
textThe text string to display.
colorThe text color. For example: TColorf(1.0,1.0,1.0)
unique_indexAn "index" for this text message, so that subsequent calls with the same index will overwrite this text message instead of creating new ones.

You'll need to refresh the display manually with forceRepaint().

See also
clearTextMessages

Definition at line 892 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, MRPT_UNUSED_PARAM, mrpt::gui::WxSubsystem::TRequestToWxMainThread::OPCODE, mrpt::gui::WxSubsystem::pushPendingWxRequest(), mrpt::gui::WxSubsystem::TRequestToWxMainThread::source3D, mrpt::gui::WxSubsystem::TRequestToWxMainThread::str, mrpt::gui::WxSubsystem::TRequestToWxMainThread::vector_x, win, mrpt::gui::WxSubsystem::TRequestToWxMainThread::x, and mrpt::gui::WxSubsystem::TRequestToWxMainThread::y.

Referenced by mrpt::graphslam::CWindowManager::addTextMessage(), mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::pauseExec(), and mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::resumeExec().

◆ addTextMessage() [2/2]

◆ captureImagesStart()

void CDisplayWindow3D::captureImagesStart ( )

Enables the grabbing of CImage objects from screenshots of the window.

See also
getLastWindowImage

Definition at line 855 of file CDisplayWindow3D.cpp.

References m_is_capturing_imgs.

◆ captureImagesStop()

void CDisplayWindow3D::captureImagesStop ( )

Stop image grabbing.

See also
captureImagesStart

Definition at line 859 of file CDisplayWindow3D.cpp.

References m_is_capturing_imgs.

◆ clearKeyHitFlag()

void mrpt::gui::CBaseGUIWindow::clearKeyHitFlag ( )
inlineinherited

Assure that "keyHit" will return false until the next pushed key.

See also
keyHit, waitForKey

Definition at line 143 of file CBaseGUIWindow.h.

References mrpt::gui::CBaseGUIWindow::m_keyPushed.

◆ clearTextMessages()

◆ Create()

CDisplayWindow3D::Ptr CDisplayWindow3D::Create ( const std::string windowCaption,
unsigned int  initialWindowWidth = 400,
unsigned int  initialWindowHeight = 300 
)
static

Class factory returning a smart pointer.

Definition at line 444 of file CDisplayWindow3D.cpp.

References CDisplayWindow3D().

◆ createOpenGLContext()

void mrpt::gui::CDisplayWindow3D::createOpenGLContext ( )
protected

Throws an exception on initialization error.

◆ createWxWindow()

◆ destroyWxWindow()

◆ doRender()

void mrpt::gui::CDisplayWindow3D::doRender ( )
protected

◆ forceRepaint()

◆ get3DSceneAndLock()

opengl::COpenGLScene::Ptr & CDisplayWindow3D::get3DSceneAndLock ( )

Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!) This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked.

Note
It is safer to use mrpt::gui::CDisplayWindow3DLocker instead.

Definition at line 545 of file CDisplayWindow3D.cpp.

References m_3Dscene, and m_csAccess3DScene.

Referenced by mrpt::gui::CDisplayWindow3DLocker::CDisplayWindow3DLocker(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), mrpt::detectors::CFaceDetection::experimental_viewRegions(), and CGraphSlamHandler< GRAPH_T >::initVisualization().

◆ getCameraAzimuthDeg()

float CDisplayWindow3D::getCameraAzimuthDeg ( ) const

Get camera parameters programmatically.

Definition at line 719 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.

◆ getCameraElevationDeg()

float CDisplayWindow3D::getCameraElevationDeg ( ) const

Get camera parameters programmatically.

Definition at line 706 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.

◆ getCameraPointingToPoint()

void CDisplayWindow3D::getCameraPointingToPoint ( float &  x,
float &  y,
float &  z 
) const

Get camera parameters programmatically.

Definition at line 732 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, MRPT_UNUSED_PARAM, and win.

◆ getCameraZoom()

float CDisplayWindow3D::getCameraZoom ( ) const

Get camera parameters programmatically.

Definition at line 755 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.

◆ getDefaultViewport()

mrpt::opengl::COpenGLViewport::Ptr CDisplayWindow3D::getDefaultViewport ( )

A short cut for getting the "main" viewport of the scene object, it is equivalent to:

mrpt::opengl::COpenGLScene::Ptr &scene = win3D.get3DSceneAndLock();
viewport = scene->getViewport("main");
win3D.unlockAccess3DScene();

Definition at line 1022 of file CDisplayWindow3D.cpp.

References m_3Dscene, and m_csAccess3DScene.

◆ getFOV()

float CDisplayWindow3D::getFOV ( ) const

Return the camera field of view (in degrees) (used for gluPerspective)

Definition at line 686 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.

◆ getLastMousePosition()

bool CDisplayWindow3D::getLastMousePosition ( int &  x,
int &  y 
) const
overridevirtual

Gets the last x,y pixel coordinates of the mouse.

Returns
False if the window is closed.
See also
getLastMousePositionRay

Implements mrpt::gui::CBaseGUIWindow.

Definition at line 781 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, MRPT_UNUSED_PARAM, and win.

Referenced by getLastMousePositionRay().

◆ getLastMousePositionRay()

bool CDisplayWindow3D::getLastMousePositionRay ( mrpt::math::TLine3D ray) const

Gets the 3D ray for the direction line of the pixel where the mouse cursor is at.

Returns
False if the window is closed.
See also
getLastMousePosition

Definition at line 798 of file CDisplayWindow3D.cpp.

References getLastMousePosition(), m_3Dscene, and m_csAccess3DScene.

◆ getLastWindowImage()

bool CDisplayWindow3D::getLastWindowImage ( mrpt::img::CImage out_img) const

Retrieve the last captured image from the window.

You MUST CALL FIRST captureImagesStart to enable image grabbing.

Returns
false if there was no time yet for grabbing any image (then, the output image is undefined).
See also
captureImagesStart, getLastWindowImagePtr

Definition at line 863 of file CDisplayWindow3D.cpp.

References m_last_captured_img, and m_last_captured_img_cs.

◆ getLastWindowImagePtr()

CImage::Ptr CDisplayWindow3D::getLastWindowImagePtr ( ) const

Retrieve the last captured image from the window, as a smart pointer.

This method is more efficient than getLastWindowImage since only a copy of the pointer is performed, while getLastWindowImage would copy the entire image.

You MUST CALL FIRST captureImagesStart to enable image grabbing. If there was no time yet for grabbing any image, an empty smart pointer will be returned.

See also
captureImagesStart, getLastWindowImage

Definition at line 883 of file CDisplayWindow3D.cpp.

References m_last_captured_img, and m_last_captured_img_cs.

◆ getPushedKey()

int CBaseGUIWindow::getPushedKey ( mrptKeyModifier out_pushModifier = nullptr)
inherited

Returns the latest pushed key, or 0 if there is no new key stroke.

Parameters
out_pushModifierIf set to !=nullptr, the modifiers of the key stroke will be saved here.
Returns
The virtual key code, as defined in <mrpt/gui/keycodes.h> (a replication of wxWidgets key codes).
See also
keyHit, waitForKey

Definition at line 190 of file CBaseGUIWindow.cpp.

References mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::gui::CBaseGUIWindow::m_keyPushed, mrpt::gui::CBaseGUIWindow::m_keyPushedCode, mrpt::gui::CBaseGUIWindow::m_keyPushedModifier, and mrpt::gui::MRPTKMOD_NONE.

◆ getRenderingFPS()

double mrpt::gui::CDisplayWindow3D::getRenderingFPS ( ) const
inline

Get the average Frames Per Second (FPS) value from the last 250 rendering events.

Definition at line 354 of file CDisplayWindow3D.h.

References m_last_FPS.

◆ getWxObject()

void* mrpt::gui::CBaseGUIWindow::getWxObject ( )
inlineinherited

Read-only access to the wxDialog object.

Definition at line 77 of file CBaseGUIWindow.h.

References mrpt::non_copiable_ptr_basic< T >::get(), and mrpt::gui::CBaseGUIWindow::m_hwnd.

Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().

◆ grabImageGetNextFile()

std::string CDisplayWindow3D::grabImageGetNextFile ( )

Increments by one the image counter and return the next image file name (Users normally don't want to call this method).

See also
grabImagesStart

Definition at line 843 of file CDisplayWindow3D.cpp.

References mrpt::format(), m_grab_imgs_idx, and m_grab_imgs_prefix.

◆ grabImagesStart()

void CDisplayWindow3D::grabImagesStart ( const std::string grab_imgs_prefix = std::string("video_"))

Start to save rendered images to disk.

Images will be saved independently as png files, depending on the template path passed to this method. For example:

path_prefix: "./video_"

Will generate "./video_000001.png", etc.

If this feature is enabled, the window will emit events of the type mrpt::gui::mrptEvent3DWindowGrabImageFile() which you can subscribe to.

See also
grabImagesStop

Definition at line 830 of file CDisplayWindow3D.cpp.

References m_grab_imgs_idx, and m_grab_imgs_prefix.

◆ grabImagesStop()

void CDisplayWindow3D::grabImagesStop ( )

Stops image grabbing started by grabImagesStart.

See also
grabImagesStart

Definition at line 839 of file CDisplayWindow3D.cpp.

References m_grab_imgs_prefix.

◆ hasSubscribers()

bool mrpt::system::CObservable::hasSubscribers ( ) const
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 53 of file CObservable.h.

References mrpt::system::CObservable::m_subscribers.

Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), and mrpt::opengl::COpenGLViewport::render().

◆ internal_emitGrabImageEvent()

void CDisplayWindow3D::internal_emitGrabImageEvent ( const std::string fil)
protected

called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers

Definition at line 1015 of file CDisplayWindow3D.cpp.

References mrpt::system::CObservable::publishEvent().

◆ internal_setRenderingFPS()

void CDisplayWindow3D::internal_setRenderingFPS ( double  FPS)
protected

Set the rendering FPS (users don't call this, the method is for internal MRPT objects only)

See also
getRenderingFPS

Definition at line 1008 of file CDisplayWindow3D.cpp.

References m_last_FPS.

◆ internalSetMinMaxRange()

void mrpt::gui::CDisplayWindow3D::internalSetMinMaxRange ( )
protected

◆ isCameraProjective()

bool CDisplayWindow3D::isCameraProjective ( ) const

Sets the camera as projective, or orthogonal.

Definition at line 768 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.

◆ isCapturingImgs()

bool mrpt::gui::CDisplayWindow3D::isCapturingImgs ( ) const
inline

Definition at line 305 of file CDisplayWindow3D.h.

References m_is_capturing_imgs.

◆ isOpen()

◆ keyHit()

bool mrpt::gui::CBaseGUIWindow::keyHit ( ) const
inlineinherited

Returns true if a key has been pushed, without blocking waiting for a new key being pushed.

See also
waitForKey, clearKeyHitFlag

Definition at line 139 of file CBaseGUIWindow.h.

References mrpt::gui::CBaseGUIWindow::m_keyPushed.

◆ notifyChildWindowDestruction()

void CBaseGUIWindow::notifyChildWindowDestruction ( )
inherited

Called by wx main thread to set m_hwnd to NULL.

Definition at line 152 of file CBaseGUIWindow.cpp.

References mrpt::gui::CBaseGUIWindow::m_hwnd.

Referenced by mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().

◆ notifySemThreadReady()

void CBaseGUIWindow::notifySemThreadReady ( )
inherited

Called by wx main thread to signal the semaphore that the wx window is built and ready.

Definition at line 217 of file CBaseGUIWindow.cpp.

References mrpt::gui::CBaseGUIWindow::m_threadReady.

Referenced by mrpt::gui::WxSubsystem::CWXMainFrame::OnTimerProcessRequests().

◆ publishEvent()

void CObservable::publishEvent ( const mrptEvent e) const
protectedinherited

◆ repaint()

void mrpt::gui::CDisplayWindow3D::repaint ( )
inline

Repaints the window.

forceRepaint, repaint and updateWindow are all aliases of the same method

Definition at line 187 of file CDisplayWindow3D.h.

References forceRepaint().

Referenced by mrpt::detectors::CFaceDetection::experimental_viewFacePointsAndEigenVects(), mrpt::detectors::CFaceDetection::experimental_viewFacePointsScanned(), and mrpt::detectors::CFaceDetection::experimental_viewRegions().

◆ resize()

◆ setCameraAzimuthDeg()

◆ setCameraElevationDeg()

◆ setCameraPointingToPoint()

◆ setCameraProjective()

void CDisplayWindow3D::setCameraProjective ( bool  isProjective)

Sets the camera as projective, or orthogonal.

Definition at line 647 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, MRPT_UNUSED_PARAM, and win.

◆ setCameraZoom()

◆ setCursorCross()

void CDisplayWindow3D::setCursorCross ( bool  cursorIsCross)
overridevirtual

Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)

See also
getLastMousePositionRay

Implements mrpt::gui::CBaseGUIWindow.

Definition at line 815 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, MRPT_UNUSED_PARAM, and win.

◆ setFOV()

void CDisplayWindow3D::setFOV ( float  v)

Changes the camera field of view (in degrees) (used for gluPerspective).

The window is not updated with this method, call "forceRepaint" to update the 3D view.

Definition at line 695 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, and win.

◆ setImageView()

void CDisplayWindow3D::setImageView ( const mrpt::img::CImage img)

Set the "main" 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()

See also
setImageView_fast, COpenGLViewport
Note
This method already locks/unlocks the 3D scene of the window, so the user must NOT call get3DSceneAndLock() / unlockAccess3DScene() before/after calling it.

Definition at line 1030 of file CDisplayWindow3D.cpp.

References m_3Dscene, and m_csAccess3DScene.

◆ setImageView_fast()

void CDisplayWindow3D::setImageView_fast ( mrpt::img::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.

See also
setImageView, COpenGLViewport
Note
This method already locks/unlocks the 3D scene of the window, so the user must NOT call get3DSceneAndLock() / unlockAccess3DScene() before/after calling it.

Definition at line 1038 of file CDisplayWindow3D.cpp.

References m_3Dscene, and m_csAccess3DScene.

◆ setMaxRange()

void CDisplayWindow3D::setMaxRange ( double  new_max)

Changes the camera max clip range (z) (used for gluPerspective.

The window is not updated with this method, call "forceRepaint" to update the 3D view.

Definition at line 671 of file CDisplayWindow3D.cpp.

References m_3Dscene.

◆ setMinRange()

void CDisplayWindow3D::setMinRange ( double  new_min)

Changes the camera min clip range (z) (used for gluPerspective).

The window is not updated with this method, call "forceRepaint" to update the 3D view.

Definition at line 657 of file CDisplayWindow3D.cpp.

References m_3Dscene.

◆ setPos()

◆ setWindowTitle()

◆ unlockAccess3DScene()

void CDisplayWindow3D::unlockAccess3DScene ( )

◆ updateWindow()

void mrpt::gui::CDisplayWindow3D::updateWindow ( )
inline

Repaints the window.

forceRepaint, repaint and updateWindow are all aliases of the same method

Definition at line 190 of file CDisplayWindow3D.h.

References forceRepaint().

◆ useCameraFromScene()

void CDisplayWindow3D::useCameraFromScene ( bool  useIt = true)

If set to true (default = false), the mouse-based scene navigation will be disabled and the camera position will be determined by the opengl viewports in the 3D scene.

Definition at line 590 of file CDisplayWindow3D.cpp.

References mrpt::non_copiable_ptr_basic< T >::get(), mrpt::gui::CBaseGUIWindow::m_hwnd, MRPT_UNUSED_PARAM, and win.

◆ waitForKey()

int CBaseGUIWindow::waitForKey ( bool  ignoreControlKeys = true,
mrptKeyModifier out_pushModifier = nullptr 
)
inherited

Waits for any key to be pushed on the image or the console, and returns the key code.

This method remove key strokes previous to its call, so it will always wait. To get the latest pushed key, see

Parameters
ignoreControlKeysIf set to false, any push of shift, cmd, control, etc... will make this method to return.
out_pushModifierIf set to !=nullptr, the modifiers of the key stroke will be saved here.
Returns
The virtual key code, as defined in mrptKeyCode (a replication of wxWidgets key codes).
See also
getPushedKey, Key codes in the enum mrptKeyCode

Definition at line 156 of file CBaseGUIWindow.cpp.

References mrpt::system::os::getch(), mrpt::gui::CBaseGUIWindow::isOpen(), mrpt::system::os::kbhit(), mrpt::gui::CBaseGUIWindow::m_keyPushed, mrpt::gui::CBaseGUIWindow::m_keyPushedCode, mrpt::gui::CBaseGUIWindow::m_keyPushedModifier, and mrpt::gui::MRPTKMOD_NONE.

Friends And Related Function Documentation

◆ C3DWindowDialog

friend class C3DWindowDialog
friend

Definition at line 123 of file CDisplayWindow3D.h.

◆ CMyGLCanvas_DisplayWindow3D

friend class CMyGLCanvas_DisplayWindow3D
friend

Definition at line 124 of file CDisplayWindow3D.h.

Member Data Documentation

◆ m_3Dscene

mrpt::opengl::COpenGLScene::Ptr mrpt::gui::CDisplayWindow3D::m_3Dscene
protected

Internal OpenGL object (see general discussion in about usage of this object)

Definition at line 128 of file CDisplayWindow3D.h.

Referenced by CDisplayWindow3D(), get3DSceneAndLock(), getDefaultViewport(), getLastMousePositionRay(), setImageView(), setImageView_fast(), setMaxRange(), and setMinRange().

◆ m_caption

◆ m_csAccess3DScene

std::recursive_mutex mrpt::gui::CDisplayWindow3D::m_csAccess3DScene
mutableprotected

◆ m_DisplayDeviceContext

mrpt::void_ptr_noncopy mrpt::gui::CDisplayWindow3D::m_DisplayDeviceContext
protected

Definition at line 135 of file CDisplayWindow3D.h.

◆ m_GLRenderingContext

mrpt::void_ptr_noncopy mrpt::gui::CDisplayWindow3D::m_GLRenderingContext
protected

Definition at line 136 of file CDisplayWindow3D.h.

◆ m_grab_imgs_idx

unsigned int mrpt::gui::CDisplayWindow3D::m_grab_imgs_idx
protected

Definition at line 139 of file CDisplayWindow3D.h.

Referenced by grabImageGetNextFile(), and grabImagesStart().

◆ m_grab_imgs_prefix

std::string mrpt::gui::CDisplayWindow3D::m_grab_imgs_prefix
protected

Definition at line 138 of file CDisplayWindow3D.h.

Referenced by grabImageGetNextFile(), grabImagesStart(), and grabImagesStop().

◆ m_hwnd

◆ m_is_capturing_imgs

bool mrpt::gui::CDisplayWindow3D::m_is_capturing_imgs
protected

Definition at line 141 of file CDisplayWindow3D.h.

Referenced by captureImagesStart(), captureImagesStop(), and isCapturingImgs().

◆ m_keyPushed

◆ m_keyPushedCode

volatile int mrpt::gui::CBaseGUIWindow::m_keyPushedCode
protectedinherited

◆ m_keyPushedModifier

volatile mrptKeyModifier mrpt::gui::CBaseGUIWindow::m_keyPushedModifier
protectedinherited

◆ m_last_captured_img

mrpt::img::CImage::Ptr mrpt::gui::CDisplayWindow3D::m_last_captured_img
protected

Definition at line 142 of file CDisplayWindow3D.h.

Referenced by getLastWindowImage(), and getLastWindowImagePtr().

◆ m_last_captured_img_cs

std::mutex mrpt::gui::CDisplayWindow3D::m_last_captured_img_cs
mutableprotected

Definition at line 143 of file CDisplayWindow3D.h.

Referenced by getLastWindowImage(), and getLastWindowImagePtr().

◆ m_last_FPS

double mrpt::gui::CDisplayWindow3D::m_last_FPS
protected
See also
getRenderingFPS

Definition at line 150 of file CDisplayWindow3D.h.

Referenced by getRenderingFPS(), and internal_setRenderingFPS().

◆ m_lastFullScreen

mrpt::system::TTimeStamp mrpt::gui::CDisplayWindow3D::m_lastFullScreen
protected

Definition at line 147 of file CDisplayWindow3D.h.

◆ m_threadReady

std::promise<void> mrpt::gui::CBaseGUIWindow::m_threadReady
mutableprotectedinherited

This semaphore will be signaled when the wx window is built and ready.

Definition at line 56 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CBaseGUIWindow::createWxWindow(), and mrpt::gui::CBaseGUIWindow::notifySemThreadReady().

◆ m_windowDestroyed

std::promise<void> mrpt::gui::CBaseGUIWindow::m_windowDestroyed
mutableprotectedinherited

This semaphore will be signaled when the wx window is destroyed.

Definition at line 58 of file CBaseGUIWindow.h.

Referenced by mrpt::gui::CBaseGUIWindow::destroyWxWindow(), mrpt::gui::CWindowDialog::OnClose(), and mrpt::gui::C3DWindowDialog::OnClose().




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