Go to the documentation of this file.
9 #ifndef CDisplayWindow3D_H
10 #define CDisplayWindow3D_H
25 class C3DWindowDialog;
26 class CMyGLCanvas_DisplayWindow3D;
84 friend class C3DWindowDialog;
85 friend class CMyGLCanvas_DisplayWindow3D;
119 const std::string &windowCaption = std::string(),
120 unsigned int initialWindowWidth = 400,
121 unsigned int initialWindowHeight = 300 );
125 const std::string &windowCaption,
126 unsigned int initialWindowWidth = 400,
127 unsigned int initialWindowHeight = 300 );
238 const std::string &text,
240 const size_t unique_index = 0,
249 const std::string &text,
251 const std::string &font_name,
252 const double font_size,
254 const size_t unique_index = 0,
255 const double font_spacing = 1.5,
256 const double font_kerning = 0.1,
257 const bool draw_shadow =
false,
316 const std::string &_img_file
317 ) : source_object(obj), img_file(_img_file) { }
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
CDisplayWindow3D(const std::string &windowCaption=std::string(), unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Constructor.
mrpt::utils::CImagePtr getLastWindowImagePtr() const
Retrieve the last captured image from the window, as a smart pointer.
void setMaxRange(double new_max)
Changes the camera max clip range (z) (used for gluPerspective. The window is not updated with this m...
void setImageView(const mrpt::utils::CImage &img)
Set the "main" viewport into "image view"-mode, where an image is efficiently drawn (fitting the view...
bool isCameraProjective() const
Sets the camera as projective, or orthogonal.
float getCameraElevationDeg() const
Get camera parameters programatically.
bool isCapturingImgs() const
TOpenGLFontStyle
Different style for vectorized font rendering.
void createOpenGLContext()
Throws an exception on initialization error.
void resize(unsigned int width, unsigned int height) MRPT_OVERRIDE
Resizes the window, stretching the image to fit into the display area.
void setCameraAzimuthDeg(float deg)
Changes the camera parameters programatically.
@ NICE
renders glyphs filled with antialiased outlines
void internalSetMinMaxRange()
mrpt::opengl::COpenGLViewportPtr getDefaultViewport()
A short cut for getting the "main" viewport of the scene object, it is equivalent to:
mrpt::utils::void_ptr_noncopy m_DisplayDeviceContext
CDisplayWindow3D * source_object
void unlockAccess3DScene()
Unlocks the access to the internal 3D scene.
void setCameraZoom(float zoom)
Changes the camera parameters programatically.
std::string m_grab_imgs_prefix
opengl::COpenGLScenePtr m_3Dscene
Internal OpenGL object (see general discussion in about usage of this object)
void setWindowTitle(const std::string &str) MRPT_OVERRIDE
Changes the window title.
void addTextMessage(const double x, const double y, const std::string &text, const mrpt::utils::TColorf &color=mrpt::utils::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.
void setFOV(float v)
Changes the camera field of view (in degrees) (used for gluPerspective). The window is not updated wi...
mrpt::utils::void_ptr_noncopy m_GLRenderingContext
bool getLastWindowImage(mrpt::utils::CImage &out_img) const
Retrieve the last captured image from the window.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class for storing images as grayscale or RGB bitmaps.
std::string grabImageGetNextFile()
Increments by one the image counter and return the next image file name (Users normally don't want to...
double getRenderingFPS() const
Get the average Frames Per Second (FPS) value from the last 250 rendering events.
void setImageView_fast(mrpt::utils::CImage &img)
Just like setImageView but moves the internal image memory instead of making a copy,...
void setPos(int x, int y) MRPT_OVERRIDE
Changes the position of the window on the screen.
static CDisplayWindow3DPtr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer.
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
An event sent by a CDisplayWindow3D window when an image is saved after enabling this feature with CD...
void captureImagesStart()
Enables the grabbing of CImage objects from screenshots of the window.
void internal_setRenderingFPS(double FPS)
Set the rendering FPS (users don't call this, the method is for internal MRPT objects only)
void clearTextMessages()
Clear all text messages created with addTextMessage().
The base class for GUI window classes.
void setCameraPointingToPoint(float x, float y, float z)
Changes the camera parameters programatically.
void setMinRange(double new_min)
Changes the camera min clip range (z) (used for gluPerspective). The window is not updated with this ...
virtual void do_nothing() MRPT_OVERRIDE
Just to allow this class to be polymorphic.
synch::CCriticalSection m_csAccess3DScene
Critical section for accesing m_3Dscene.
void getCameraPointingToPoint(float &x, float &y, float &z) const
Get camera parameters programatically.
This class provides simple critical sections functionality.
void grabImagesStop()
Stops image grabbing started by grabImagesStart.
void setCameraProjective(bool isProjective)
Sets the camera as projective, or orthogonal.
mrpt::system::TTimeStamp m_lastFullScreen
float getFOV() const
Return the camera field of view (in degrees) (used for gluPerspective)
void grabImagesStart(const std::string &grab_imgs_prefix=std::string("video_"))
Start to save rendered images to disk.
mrpt::utils::CImagePtr m_last_captured_img
#define DEFINE_MRPT_OBJECT_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void addTextMessage(const double x_frac, const double y_frac, const std::string &text, const mrpt::utils::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::utils::TColorf &shadow_color=mrpt::utils::TColorf(0, 0, 0))
mrptEvent3DWindowGrabImageFile(CDisplayWindow3D *obj, const std::string &_img_file)
A RGB color - floats in the range [0,1].
unsigned int m_grab_imgs_idx
void setCameraElevationDeg(float deg)
Changes the camera parameters programatically.
virtual void setCursorCross(bool cursorIsCross) MRPT_OVERRIDE
Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true)
void captureImagesStop()
Stop image grabbing.
3D line, represented by a base point and a director vector.
void forceRepaint()
Repaints the window. forceRepaint, repaint and updateWindow are all aliases of the same method.
void internal_emitGrabImageEvent(const std::string &fil)
called by CMyGLCanvas_DisplayWindow3D::OnPostRenderSwapBuffers
opengl::COpenGLScenePtr & get3DSceneAndLock()
Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introductio...
void useCameraFromScene(bool useIt=true)
If set to true (default = false), the mouse-based scene navigation will be disabled and the camera po...
const std::string & img_file
The absolute path of the file that has been just saved.
virtual ~CDisplayWindow3D()
Destructor.
virtual bool getLastMousePosition(int &x, int &y) const MRPT_OVERRIDE
Gets the last x,y pixel coordinates of the mouse.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
@ MRPT_GLUT_BITMAP_TIMES_ROMAN_24
#define DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
float getCameraZoom() const
Get camera parameters programatically.
#define DEFINE_MRPT_OBJECT(class_name)
This declaration must be inserted in all CObject classes definition, within the class declaration.
synch::CCriticalSection m_last_captured_img_cs
float getCameraAzimuthDeg() const
Get camera parameters programatically.
bool getLastMousePositionRay(mrpt::math::TLine3D &ray) const
Gets the 3D ray for the direction line of the pixel where the mouse cursor is at.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |