21 class C3DWindowDialog;
22 class CMyGLCanvas_DisplayWindow3D;
158 const std::string& windowCaption = std::string(),
159 unsigned int initialWindowWidth = 400,
160 unsigned int initialWindowHeight = 300);
164 const std::string& windowCaption,
unsigned int initialWindowWidth = 400,
165 unsigned int initialWindowHeight = 300);
209 void resize(
unsigned int width,
unsigned int height)
override;
211 void setPos(
int x,
int y)
override;
263 const std::string& grab_imgs_prefix = std::string(
"video_"));
313 const double x_frac,
const double y_frac,
const std::string& text,
314 const size_t unique_index = 0,
320 if (!gl_view)
return;
321 gl_view->addTextMessage(x_frac, y_frac, text, unique_index, fontParams);
333 if (!gl_view)
return;
334 gl_view->clearTextMessages();
347 if (!gl_view)
return false;
348 return gl_view->updateTextMessage(unique_index, text);
bool getLastMousePosition(int &x, int &y) const override
Gets the last x,y pixel coordinates of the mouse.
float getCameraAzimuthDeg() const
Get camera parameters programmatically.
bool getLastMousePositionRay(mrpt::math::TLine3D &ray) const
Gets the 3D ray for the direction line of the pixel where the mouse cursor is at. ...
An event sent by a CDisplayWindow3D window when an image is saved after enabling this feature with CD...
Auxiliary class for safely claiming the 3DScene of a mrpt::gui::CDisplayWindow3D. ...
void unlockAccess3DScene()
Unlocks the access to the internal 3D scene.
mrpt::img::CImage::Ptr getLastWindowImagePtr() const
Retrieve the last captured image from the window, as a smart pointer.
void internalSetMinMaxRange()
CDisplayWindow3DLocker(CDisplayWindow3D &win, mrpt::opengl::COpenGLScene::Ptr &out_scene_ptr)
Acquires the lock of the 3D scene of the referenced window, and returns a copy of the smart pointer t...
bool isCapturingImgs() const
void setWindowTitle(const std::string &str) override
Changes the window title.
void clearTextMessages()
Clear all text messages created with addTextMessage().
mrpt::opengl::COpenGLScene::Ptr & get3DSceneAndLock()
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introductio...
void grabImagesStart(const std::string &grab_imgs_prefix=std::string("video_"))
Start to save rendered images to disk.
void resize(unsigned int width, unsigned int height) override
Resizes the window, stretching the image to fit into the display area.
The basic event type for the observer-observable pattern in MRPT.
void setCameraPointingToPoint(float x, float y, float z)
Changes the camera parameters programmatically.
A description of a bitmapped or vectorized text font.
void createOpenGLContext()
Throws an exception on initialization error.
~CDisplayWindow3DLocker()
void setMaxRange(float new_max)
Changes the camera max clip range (z) (used for gluPerspective.
static CDisplayWindow3D::Ptr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer.
void internal_emitGrabImageEvent(const std::string &fil)
called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers
void setCameraProjective(bool isProjective)
Sets the camera as projective, or orthogonal.
mrpt::void_ptr_noncopy m_GLRenderingContext
float getCameraZoom() const
Get camera parameters programmatically.
CDisplayWindow3D * source_object
friend class CMyGLCanvas_DisplayWindow3D
mrpt::opengl::COpenGLViewport::Ptr getDefaultViewport()
A short cut for getting the "main" viewport of the scene object, it is equivalent to: ...
double getRenderingFPS() const
Get the average Frames Per Second (FPS) value from the last 250 rendering events. ...
void setMinRange(float new_min)
Changes the camera min clip range (z) (used for gluPerspective).
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
mrpt::void_ptr_noncopy m_DisplayDeviceContext
const std::string & img_file
The absolute path of the file that has been just saved.
void getCameraPointingToPoint(float &x, float &y, float &z) const
Get camera parameters programmatically.
void setPos(int x, int y) override
Changes the position of the window on the screen.
~CDisplayWindow3D() override
Destructor.
std::string grabImageGetNextFile()
Increments by one the image counter and return the next image file name (Users normally don't want to...
unsigned int m_grab_imgs_idx
std::string m_grab_imgs_prefix
mrpt::gui::CDisplayWindow3D::Ptr win
void forceRepaint()
Repaints the window.
void setImageView(const mrpt::img::CImage &img)
Set the "main" viewport into "image view"-mode, where an image is efficiently drawn (fitting the view...
mrptEvent3DWindowGrabImageFile(CDisplayWindow3D *obj, const std::string &_img_file)
float getFOV() const
Return the camera field of view (in degrees) (used for gluPerspective)
std::recursive_timed_mutex m_csAccess3DScene
Critical section for accesing m_3Dscene.
void addTextMessage(const double x_frac, const double y_frac, const std::string &text, const size_t unique_index=0, const mrpt::opengl::TFontParams &fontParams=mrpt::opengl::TFontParams())
A shortcut for calling mrpt::opengl::COpenGLViewport::addTextMessage() in the "main" viewport of the ...
mrpt::system::TTimeStamp m_lastFullScreen
void grabImagesStop()
Stops image grabbing started by grabImagesStart.
bool isCameraProjective() const
Sets the camera as projective, or orthogonal.
void setCameraZoom(float zoom)
Changes the camera parameters programmatically.
bool updateTextMessage(const size_t unique_index, const std::string &text)
Just updates the text of a given text message, without touching the other parameters.
void updateWindow()
Repaints the window.
void setCursorCross(bool cursorIsCross) override
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) ...
bool getLastWindowImage(mrpt::img::CImage &out_img) const
Retrieve the last captured image from the window.
mrpt::img::CImage::Ptr m_last_captured_img
Classes for creating GUI windows for 2D and 3D visualization.
void captureImagesStop()
Stop image grabbing.
CDisplayWindow3D(const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Constructor.
void repaint()
Repaints the window.
void internal_setRenderingFPS(double FPS)
Set the rendering FPS (users don't call this, the method is for internal MRPT objects only) ...
std::mutex m_last_captured_img_cs
mrpt::opengl::COpenGLScene::Ptr m_3Dscene
Internal OpenGL object (see general discussion in about usage of this object)
The base class for GUI window classes based on wxWidgets.
void setFOV(float v)
Changes the camera field of view (in degrees) (used for gluPerspective).
void setCameraAzimuthDeg(float deg)
Changes the camera parameters programmatically.
void do_nothing() override
Just to allow this class to be polymorphic.
A class for storing images as grayscale or RGB bitmaps.
void setCameraElevationDeg(float deg)
Changes the camera parameters programmatically.
void useCameraFromScene(bool useIt=true)
If set to true (default = false), the mouse-based scene navigation will be disabled and the camera po...
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
void captureImagesStart()
Enables the grabbing of CImage objects from screenshots of the window.
3D line, represented by a base point and a director vector.
float getCameraElevationDeg() const
Get camera parameters programmatically.