#include <mrpt/gui/CDisplayWindow3D.h>
Public Member Functions | |
void * | getWxObject () |
Read-only access to the wxDialog object. | |
void | notifyChildWindowDestruction () |
Called by wx main thread to set m_hwnd to NULL. | |
CDisplayWindow3D (const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300) | |
Constructor. | |
~CDisplayWindow3D () | |
Destructor. | |
opengl::COpenGLScenePtr & | 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. | |
void | unlockAccess3DScene () |
Unlocks the access to the internal 3D scene. | |
void | forceRepaint () |
Repaints the window. | |
void | repaint () |
Repaints the window. | |
void | updateWindow () |
Repaints the window. | |
float | getMinRange () const |
Return the camera min range (z) (used for gluPerspective). | |
float | getMaxRange () const |
Return the camera max range (z) (used for gluPerspective). | |
float | getFOV () const |
Return the camera field of view (in degrees) (used for gluPerspective). | |
void | setMinRange (float v) |
Changes the camera min range (z) (used for gluPerspective). | |
void | setMaxRange (float v) |
Changes the camera max range (z) (used for gluPerspective). | |
void | setFOV (float v) |
Changes the camera field of view (in degrees) (used for gluPerspective). | |
void | resize (unsigned int width, unsigned int height) |
Resizes the window, stretching the image to fit into the display area. | |
void | setPos (int x, int y) |
Changes the position of the window on the screen. | |
void | setWindowTitle (const std::string &str) |
Changes the window title. | |
int | waitForKey () |
Waits for any key to be pushed on the image or the console, and returns the key code. | |
bool | keyHit () const |
Returns true if a key has been pushed, without blocking waiting for a new key being pushed. | |
void | clearKeyHitFlag () |
Assure that "keyHit" will return false until the next pushed key. | |
void | setCameraElevationDeg (float deg) |
Changes the camera parameters programatically. | |
void | setCameraAzimuthDeg (float deg) |
Changes the camera parameters programatically. | |
void | setCameraPointingToPoint (float x, float y, float z) |
Changes the camera parameters programatically. | |
void | setCameraZoom (float zoom) |
Changes the camera parameters programatically. | |
void | setCameraProjective (bool isProjective) |
Sets the camera as projective, or orthogonal. | |
bool | isOpen () |
Returns false if the user has closed the window. | |
void | grabImagesStart (const std::string &grab_imgs_prefix=std::string("video_")) |
Start to save rendered images to disk. | |
void | grabImagesStop () |
Stops image grabbing started by grabImagesStart. | |
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). | |
Public Attributes | |
synch::CSemaphore | m_semThreadReady |
This semaphore will be signaled when the wx window is built and ready. | |
synch::CSemaphore | m_semWindowDestroyed |
This semaphore will be signaled when the wx window is destroyed. | |
Protected Member Functions | |
void | createOpenGLContext () |
Throws an exception on initialization error. | |
void | doRender () |
Protected Attributes | |
float | m_minRange |
float | m_maxRange |
float | m_FOV |
std::string | m_caption |
The caption of the window:. | |
void_ptr_noncopy | m_hwnd |
The window's handle. | |
opengl::COpenGLScenePtr | m_3Dscene |
Internal OpenGL object (see general discussion in about usage of this object). | |
synch::CCriticalSection | m_csAccess3DScene |
Critical section for accesing m_3Dscene. | |
volatile bool | m_keyPushed |
Auxiliar. | |
volatile int | m_keyPushedCode |
void_ptr_noncopy | m_DisplayDeviceContext |
void_ptr_noncopy | m_GLRenderingContext |
std::string | m_grab_imgs_prefix |
unsigned int | m_grab_imgs_idx |
Friends | |
class | C3DWindowDialog |
This class always contains internally an instance of opengl::COpenGLScene, which the objects, viewports, etc. to be rendered.
Since MRPT 0.6.2, images can be grabbed automatically to disk for easy creation of videos. See CDisplayWindow3D::grabImagesStart
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:
CDisplayWindow3D win("My window"); // Adquire the scene: opengl::COpenGLScenePtr &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.
Definition at line 92 of file CDisplayWindow3D.h.
mrpt::gui::CDisplayWindow3D::CDisplayWindow3D | ( | const std::string & | windowCaption = std::string() , |
|
unsigned int | initialWindowWidth = 400 , |
|||
unsigned int | initialWindowHeight = 300 | |||
) |
Constructor.
mrpt::gui::CDisplayWindow3D::~CDisplayWindow3D | ( | ) |
Destructor.
void mrpt::gui::CDisplayWindow3D::clearKeyHitFlag | ( | ) | [inline] |
Assure that "keyHit" will return false until the next pushed key.
Definition at line 246 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::createOpenGLContext | ( | ) | [protected] |
Throws an exception on initialization error.
void mrpt::gui::CDisplayWindow3D::doRender | ( | ) | [protected] |
void mrpt::gui::CDisplayWindow3D::forceRepaint | ( | ) |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method.
opengl::COpenGLScenePtr& mrpt::gui::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.
float mrpt::gui::CDisplayWindow3D::getFOV | ( | ) | const [inline] |
Return the camera field of view (in degrees) (used for gluPerspective).
Definition at line 201 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::getMaxRange | ( | ) | const [inline] |
Return the camera max range (z) (used for gluPerspective).
Definition at line 197 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::getMinRange | ( | ) | const [inline] |
Return the camera min range (z) (used for gluPerspective).
Definition at line 193 of file CDisplayWindow3D.h.
void* mrpt::gui::CDisplayWindow3D::getWxObject | ( | ) | [inline] |
std::string mrpt::gui::CDisplayWindow3D::grabImageGetNextFile | ( | ) |
Increments by one the image counter and return the next image file name (Users normally don't want to call this method).
void mrpt::gui::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.
void mrpt::gui::CDisplayWindow3D::grabImagesStop | ( | ) |
bool mrpt::gui::CDisplayWindow3D::isOpen | ( | ) |
Returns false if the user has closed the window.
bool mrpt::gui::CDisplayWindow3D::keyHit | ( | ) | const [inline] |
Returns true if a key has been pushed, without blocking waiting for a new key being pushed.
Definition at line 238 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::notifyChildWindowDestruction | ( | ) |
Called by wx main thread to set m_hwnd to NULL.
void mrpt::gui::CDisplayWindow3D::repaint | ( | ) | [inline] |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method.
Definition at line 184 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::resize | ( | unsigned int | width, | |
unsigned int | height | |||
) |
Resizes the window, stretching the image to fit into the display area.
void mrpt::gui::CDisplayWindow3D::setCameraAzimuthDeg | ( | float | deg | ) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setCameraElevationDeg | ( | float | deg | ) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setCameraPointingToPoint | ( | float | x, | |
float | y, | |||
float | z | |||
) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setCameraProjective | ( | bool | isProjective | ) |
Sets the camera as projective, or orthogonal.
void mrpt::gui::CDisplayWindow3D::setCameraZoom | ( | float | zoom | ) |
Changes the camera parameters programatically.
void mrpt::gui::CDisplayWindow3D::setFOV | ( | float | v | ) | [inline] |
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 216 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::setMaxRange | ( | float | v | ) | [inline] |
Changes the camera max range (z) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 211 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::setMinRange | ( | float | v | ) | [inline] |
Changes the camera min range (z) (used for gluPerspective).
The window is not updated with this method, call "forceRepaint" to update the 3D view.
Definition at line 206 of file CDisplayWindow3D.h.
void mrpt::gui::CDisplayWindow3D::setPos | ( | int | x, | |
int | y | |||
) |
Changes the position of the window on the screen.
void mrpt::gui::CDisplayWindow3D::setWindowTitle | ( | const std::string & | str | ) |
Changes the window title.
void mrpt::gui::CDisplayWindow3D::unlockAccess3DScene | ( | ) |
Unlocks the access to the internal 3D scene.
Typically user will want to call forceRepaint after updating the scene.
void mrpt::gui::CDisplayWindow3D::updateWindow | ( | ) | [inline] |
Repaints the window.
forceRepaint, repaint and updateWindow are all aliases of the same method.
Definition at line 189 of file CDisplayWindow3D.h.
int mrpt::gui::CDisplayWindow3D::waitForKey | ( | ) |
Waits for any key to be pushed on the image or the console, and returns the key code.
Key codes are Virtual Key Codes from wxWidgets: http://docs.wxwidgets.org/stable/wx_keycodes.html
friend class C3DWindowDialog [friend] |
Definition at line 97 of file CDisplayWindow3D.h.
opengl::COpenGLScenePtr mrpt::gui::CDisplayWindow3D::m_3Dscene [protected] |
Internal OpenGL object (see general discussion in about usage of this object).
Definition at line 132 of file CDisplayWindow3D.h.
std::string mrpt::gui::CDisplayWindow3D::m_caption [protected] |
Definition at line 146 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::m_FOV [protected] |
Definition at line 119 of file CDisplayWindow3D.h.
Definition at line 147 of file CDisplayWindow3D.h.
unsigned int mrpt::gui::CDisplayWindow3D::m_grab_imgs_idx [protected] |
Definition at line 150 of file CDisplayWindow3D.h.
std::string mrpt::gui::CDisplayWindow3D::m_grab_imgs_prefix [protected] |
Definition at line 149 of file CDisplayWindow3D.h.
void_ptr_noncopy mrpt::gui::CDisplayWindow3D::m_hwnd [protected] |
volatile bool mrpt::gui::CDisplayWindow3D::m_keyPushed [protected] |
volatile int mrpt::gui::CDisplayWindow3D::m_keyPushedCode [protected] |
Definition at line 140 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::m_maxRange [protected] |
Definition at line 119 of file CDisplayWindow3D.h.
float mrpt::gui::CDisplayWindow3D::m_minRange [protected] |
Definition at line 119 of file CDisplayWindow3D.h.
This semaphore will be signaled when the wx window is built and ready.
Definition at line 102 of file CDisplayWindow3D.h.
This semaphore will be signaled when the wx window is destroyed.
Definition at line 106 of file CDisplayWindow3D.h.
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:18:33 EST 2009 |