MRPT  2.0.4
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions
mrpt::gui::CGlCanvasBaseHeadless Class Reference

Detailed Description

A headless dummy implementation of CGlCanvasBase: can be used to keep track of user UI mouse events and update the camera parameters, with actual rendering being delegated to someone else.

Definition at line 261 of file CGlCanvasBase.h.

#include <mrpt/gui/CGlCanvasBase.h>

Inheritance diagram for mrpt::gui::CGlCanvasBaseHeadless:

Public Member Functions

 CGlCanvasBaseHeadless ()=default
 
virtual ~CGlCanvasBaseHeadless () override=default
 
void setMinimumZoom (float zoom)
 Sets the minimum of the zoom See also setMaximumZoom(float) More...
 
void setMaximumZoom (float zoom)
 Sets the maximum of the zoom See also setMinimumZoom(float) More...
 
void setMousePos (int x, int y)
 Saves the click position of the mouse See also setMouseClicked(bool) More...
 
void setMouseClicked (bool is)
 Sets the property mouseClicked By default, this property is false. More...
 
void updateLastPos (int x, int y)
 Sets the last mouse position. More...
 
void resizeViewport (int w, int h)
 Calls the glViewport function. More...
 
void clearColors ()
 Calls the glClearColor function See also setClearColors(float, float, float, float) More...
 
void updateZoom (CamaraParams &params, int x, int y) const
 This function for the mouse event It gets a reference to CamaraParams, x, y and updates the zoom of the CameraParams. More...
 
void updateZoom (CamaraParams &params, float delta) const
 This function for the wheel event It gets a reference to CamaraParams, delta and updates the zoom of the CameraParams. More...
 
void updateRotate (CamaraParams &params, int x, int y) const
 This function for the mouse event It gets a reference to CamaraParams, x, y and updates the elevation and azimuth. More...
 
void updateOrbitCamera (CamaraParams &params, int x, int y) const
 This function for the mouse event It gets a reference to CamaraParams, x, y and updates the elevation and azimuth. More...
 
void updatePan (CamaraParams &params, int x, int y) const
 This function for the mouse event It gets a reference to CamaraParams, x, y and updates the pointing of the camera. More...
 
CamaraParams cameraParams () const
 Returns a copy of CamaraParams See also getRefCameraParams(), setCameraParams(const CamaraParams &) More...
 
const CamaraParamsgetRefCameraParams () const
 Returns a reference to CamaraParams See also cameraParams(), setCameraParams(const CamaraParams &) More...
 
virtual void setCameraParams (const CamaraParams &params)
 Sets the CamaraParams See also cameraParams(), getRefCameraParams() More...
 
mrpt::opengl::CCameraupdateCameraParams (mrpt::opengl::CCamera &cam) const
 This function gets a reference to mrpt::opengl::CCamera and updates the camera parameters(pointing, zoom, azimuth, elevation, IsProjective, FOV) More...
 
void setUseCameraFromScene (bool is)
 If set to true (default=false), the cameraPointingX,... More...
 
bool getUseCameraFromScene () const
 See also void setUseCameraFromScene(bool) More...
 
virtual void setCameraPointing (float pointX, float pointY, float pointZ)
 Saves the pointing of the camera See also getCameraPointingX(), getCameraPointingY(), getCameraPointingZ() More...
 
float getCameraPointingX () const
 Returns the x pointing of the camera See also setCameraPointing(float, float, float) More...
 
float getCameraPointingY () const
 Returns the y pointing of the camera See also setCameraPointing(float, float, float) More...
 
float getCameraPointingZ () const
 Returns the z pointing of the camera See also setCameraPointing(float, float, float) More...
 
virtual void setZoomDistance (float zoom)
 Saves camera zooming See also getZoomDistance() More...
 
float getZoomDistance () const
 Returns a zoom See also setZoomDistance(float) More...
 
virtual void setAzimuthDegrees (float ang)
 Saves the degrees of the azimuth camera See also getAzimuthDegrees() More...
 
float getAzimuthDegrees () const
 Returns a azimuth degrees See also setAzimuthDegrees(float) More...
 
virtual void setElevationDegrees (float ang)
 Saves the degrees of the elevation camera See also getElevationDegrees() More...
 
float getElevationDegrees () const
 Returns a elevation degrees See also setElevationDegrees(float) More...
 
virtual void setCameraProjective (bool is)
 
bool isCameraProjective () const
 
virtual void setCameraFOV (float FOV)
 
float cameraFOV () const
 
void setClearColors (float r, float g, float b, float a=1.0f)
 Sets the RGBA colors for glClearColor See also clearColors(), getClearColorR(), getClearColorG(),getClearColorB(), getClearColorA() More...
 
float getClearColorR () const
 
float getClearColorG () const
 
float getClearColorB () const
 
float getClearColorA () const
 
virtual void OnUserManuallyMovesCamera (float new_cameraPointingX, float new_cameraPointingY, float new_cameraPointingZ, float new_cameraZoomDistance, float new_cameraElevationDeg, float new_cameraAzimuthDeg)
 Overload this method to limit the capabilities of the user to move the camera using the mouse. More...
 
void getLastMousePosition (int &x, int &y) const
 
mrpt::opengl::COpenGLScene::PtrgetOpenGLSceneRef ()
 At constructor an empty scene is created. More...
 
void setOpenGLSceneRef (mrpt::opengl::COpenGLScene::Ptr scene)
 

Static Public Attributes

static float SENSIBILITY_DEG_PER_PIXEL = 0.1f
 

Protected Member Functions

virtual void swapBuffers () override
 
virtual void preRender () override
 
virtual void postRender () override
 
virtual void renderError (const std::string &e) override
 
virtual double renderCanvas (int width=-1, int height=-1)
 

Constructor & Destructor Documentation

◆ CGlCanvasBaseHeadless()

mrpt::gui::CGlCanvasBaseHeadless::CGlCanvasBaseHeadless ( )
default

◆ ~CGlCanvasBaseHeadless()

virtual mrpt::gui::CGlCanvasBaseHeadless::~CGlCanvasBaseHeadless ( )
overridevirtualdefault

Member Function Documentation

◆ cameraFOV()

float CGlCanvasBase::cameraFOV ( ) const
inherited

Definition at line 238 of file CGlCanvasBase.cpp.

◆ cameraParams()

CGlCanvasBase::CamaraParams CGlCanvasBase::cameraParams ( ) const
inherited

Returns a copy of CamaraParams See also getRefCameraParams(), setCameraParams(const CamaraParams &)

Definition at line 166 of file CGlCanvasBase.cpp.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent(), and mrpt::gui::internal::NanoGUICanvasHeadless::scrollEvent().

Here is the caller graph for this function:

◆ clearColors()

void CGlCanvasBase::clearColors ( )
inherited

Calls the glClearColor function See also setClearColors(float, float, float, float)

Definition at line 148 of file CGlCanvasBase.cpp.

◆ getAzimuthDegrees()

float CGlCanvasBase::getAzimuthDegrees ( ) const
inherited

Returns a azimuth degrees See also setAzimuthDegrees(float)

Definition at line 217 of file CGlCanvasBase.cpp.

◆ getCameraPointingX()

float CGlCanvasBase::getCameraPointingX ( ) const
inherited

Returns the x pointing of the camera See also setCameraPointing(float, float, float)

Definition at line 263 of file CGlCanvasBase.cpp.

◆ getCameraPointingY()

float CGlCanvasBase::getCameraPointingY ( ) const
inherited

Returns the y pointing of the camera See also setCameraPointing(float, float, float)

Definition at line 268 of file CGlCanvasBase.cpp.

◆ getCameraPointingZ()

float CGlCanvasBase::getCameraPointingZ ( ) const
inherited

Returns the z pointing of the camera See also setCameraPointing(float, float, float)

Definition at line 273 of file CGlCanvasBase.cpp.

◆ getClearColorA()

float CGlCanvasBase::getClearColorA ( ) const
inherited

Definition at line 250 of file CGlCanvasBase.cpp.

◆ getClearColorB()

float CGlCanvasBase::getClearColorB ( ) const
inherited

Definition at line 249 of file CGlCanvasBase.cpp.

◆ getClearColorG()

float CGlCanvasBase::getClearColorG ( ) const
inherited

Definition at line 248 of file CGlCanvasBase.cpp.

◆ getClearColorR()

float CGlCanvasBase::getClearColorR ( ) const
inherited

Definition at line 247 of file CGlCanvasBase.cpp.

◆ getElevationDegrees()

float CGlCanvasBase::getElevationDegrees ( ) const
inherited

Returns a elevation degrees See also setElevationDegrees(float)

Definition at line 222 of file CGlCanvasBase.cpp.

◆ getLastMousePosition()

void mrpt::gui::CGlCanvasBase::getLastMousePosition ( int &  x,
int &  y 
) const
inlineinherited

◆ getOpenGLSceneRef()

mrpt::opengl::COpenGLScene::Ptr& mrpt::gui::CGlCanvasBase::getOpenGLSceneRef ( )
inlineinherited

At constructor an empty scene is created.

The object is freed at GL canvas destructor. This function returns a smart pointer to the opengl scene getOpenGLSceneRef

Definition at line 229 of file CGlCanvasBase.h.

References mrpt::gui::CGlCanvasBase::m_openGLScene.

◆ getRefCameraParams()

const CGlCanvasBase::CamaraParams & CGlCanvasBase::getRefCameraParams ( ) const
inherited

Returns a reference to CamaraParams See also cameraParams(), setCameraParams(const CamaraParams &)

Definition at line 171 of file CGlCanvasBase.cpp.

◆ getUseCameraFromScene()

bool CGlCanvasBase::getUseCameraFromScene ( ) const
inherited

See also void setUseCameraFromScene(bool)

Definition at line 206 of file CGlCanvasBase.cpp.

◆ getZoomDistance()

float CGlCanvasBase::getZoomDistance ( ) const
inherited

Returns a zoom See also setZoomDistance(float)

Definition at line 181 of file CGlCanvasBase.cpp.

◆ isCameraProjective()

bool CGlCanvasBase::isCameraProjective ( ) const
inherited

Definition at line 232 of file CGlCanvasBase.cpp.

◆ OnUserManuallyMovesCamera()

virtual void mrpt::gui::CGlCanvasBase::OnUserManuallyMovesCamera ( float  new_cameraPointingX,
float  new_cameraPointingY,
float  new_cameraPointingZ,
float  new_cameraZoomDistance,
float  new_cameraElevationDeg,
float  new_cameraAzimuthDeg 
)
inlinevirtualinherited

Overload this method to limit the capabilities of the user to move the camera using the mouse.

For all these variables:

  • cameraPointingX
  • cameraPointingY
  • cameraPointingZ
  • cameraZoomDistance
  • cameraElevationDeg
  • cameraAzimuthDeg

A "new_NAME" variable will be passed with the temptative new value after the user action. The default behavior should be to copy all the new variables to the variables listed above but in the middle any find of user-defined filter can be implemented.

Definition at line 206 of file CGlCanvasBase.h.

References mrpt::gui::CGlCanvasBase::CamaraParams::cameraAzimuthDeg, mrpt::gui::CGlCanvasBase::CamaraParams::cameraElevationDeg, mrpt::gui::CGlCanvasBase::CamaraParams::cameraPointingX, mrpt::gui::CGlCanvasBase::CamaraParams::cameraPointingY, mrpt::gui::CGlCanvasBase::CamaraParams::cameraPointingZ, mrpt::gui::CGlCanvasBase::CamaraParams::cameraZoomDistance, and mrpt::gui::CGlCanvasBase::m_cameraParams.

◆ postRender()

virtual void mrpt::gui::CGlCanvasBaseHeadless::postRender ( )
inlineoverrideprotectedvirtual

Implements mrpt::gui::CGlCanvasBase.

Definition at line 270 of file CGlCanvasBase.h.

◆ preRender()

virtual void mrpt::gui::CGlCanvasBaseHeadless::preRender ( )
inlineoverrideprotectedvirtual

Implements mrpt::gui::CGlCanvasBase.

Definition at line 269 of file CGlCanvasBase.h.

◆ renderCanvas()

double CGlCanvasBase::renderCanvas ( int  width = -1,
int  height = -1 
)
protectedvirtualinherited

Definition at line 278 of file CGlCanvasBase.cpp.

References mrpt::exception_to_str(), mrpt::system::CTicTac::Tac(), THROW_EXCEPTION, and mrpt::system::CTicTac::Tic().

Here is the call graph for this function:

◆ renderError()

void CGlCanvasBaseHeadless::renderError ( const std::string &  e)
overrideprotectedvirtual

Implements mrpt::gui::CGlCanvasBase.

Definition at line 358 of file CGlCanvasBase.cpp.

◆ resizeViewport()

void CGlCanvasBase::resizeViewport ( int  w,
int  h 
)
inherited

Calls the glViewport function.

Definition at line 139 of file CGlCanvasBase.cpp.

◆ setAzimuthDegrees()

void CGlCanvasBase::setAzimuthDegrees ( float  ang)
virtualinherited

Saves the degrees of the azimuth camera See also getAzimuthDegrees()

Definition at line 207 of file CGlCanvasBase.cpp.

◆ setCameraFOV()

void CGlCanvasBase::setCameraFOV ( float  FOV)
virtualinherited

Definition at line 237 of file CGlCanvasBase.cpp.

◆ setCameraParams()

void CGlCanvasBase::setCameraParams ( const CamaraParams params)
virtualinherited

Sets the CamaraParams See also cameraParams(), getRefCameraParams()

Definition at line 176 of file CGlCanvasBase.cpp.

References params.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent(), and mrpt::gui::internal::NanoGUICanvasHeadless::scrollEvent().

Here is the caller graph for this function:

◆ setCameraPointing()

void CGlCanvasBase::setCameraPointing ( float  pointX,
float  pointY,
float  pointZ 
)
virtualinherited

Saves the pointing of the camera See also getCameraPointingX(), getCameraPointingY(), getCameraPointingZ()

Definition at line 256 of file CGlCanvasBase.cpp.

◆ setCameraProjective()

void CGlCanvasBase::setCameraProjective ( bool  is)
virtualinherited

Definition at line 227 of file CGlCanvasBase.cpp.

◆ setClearColors()

void CGlCanvasBase::setClearColors ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inherited

Sets the RGBA colors for glClearColor See also clearColors(), getClearColorR(), getClearColorG(),getClearColorB(), getClearColorA()

Definition at line 239 of file CGlCanvasBase.cpp.

◆ setElevationDegrees()

void CGlCanvasBase::setElevationDegrees ( float  ang)
virtualinherited

Saves the degrees of the elevation camera See also getElevationDegrees()

Definition at line 212 of file CGlCanvasBase.cpp.

◆ setMaximumZoom()

void CGlCanvasBase::setMaximumZoom ( float  zoom)
inherited

Sets the maximum of the zoom See also setMinimumZoom(float)

Definition at line 54 of file CGlCanvasBase.cpp.

◆ setMinimumZoom()

void CGlCanvasBase::setMinimumZoom ( float  zoom)
inherited

Sets the minimum of the zoom See also setMaximumZoom(float)

Definition at line 53 of file CGlCanvasBase.cpp.

◆ setMouseClicked()

void CGlCanvasBase::setMouseClicked ( bool  is)
inherited

Sets the property mouseClicked By default, this property is false.

See also setMousePos(int, int)

Definition at line 61 of file CGlCanvasBase.cpp.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseButtonEvent().

Here is the caller graph for this function:

◆ setMousePos()

void CGlCanvasBase::setMousePos ( int  x,
int  y 
)
inherited

Saves the click position of the mouse See also setMouseClicked(bool)

Definition at line 55 of file CGlCanvasBase.cpp.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseButtonEvent(), and mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent().

Here is the caller graph for this function:

◆ setOpenGLSceneRef()

void CGlCanvasBase::setOpenGLSceneRef ( mrpt::opengl::COpenGLScene::Ptr  scene)
inherited

Definition at line 251 of file CGlCanvasBase.cpp.

◆ setUseCameraFromScene()

void CGlCanvasBase::setUseCameraFromScene ( bool  is)
inherited

If set to true (default=false), the cameraPointingX,...

parameters are ignored and the camera stored in the 3D scene is used instead. See also void bool getUseCameraFromScene()

Definition at line 205 of file CGlCanvasBase.cpp.

◆ setZoomDistance()

void CGlCanvasBase::setZoomDistance ( float  zoom)
virtualinherited

Saves camera zooming See also getZoomDistance()

Definition at line 186 of file CGlCanvasBase.cpp.

◆ swapBuffers()

virtual void mrpt::gui::CGlCanvasBaseHeadless::swapBuffers ( )
inlineoverrideprotectedvirtual

Implements mrpt::gui::CGlCanvasBase.

Definition at line 268 of file CGlCanvasBase.h.

◆ updateCameraParams()

CCamera & CGlCanvasBase::updateCameraParams ( mrpt::opengl::CCamera cam) const
inherited

This function gets a reference to mrpt::opengl::CCamera and updates the camera parameters(pointing, zoom, azimuth, elevation, IsProjective, FOV)

Definition at line 191 of file CGlCanvasBase.cpp.

References mrpt::opengl::CCamera::setAzimuthDegrees(), mrpt::opengl::CCamera::setElevationDegrees(), mrpt::opengl::CCamera::setPointingAt(), mrpt::opengl::CCamera::setProjectiveFOVdeg(), mrpt::opengl::CCamera::setProjectiveModel(), and mrpt::opengl::CCamera::setZoomDistance().

Referenced by mrpt::gui::CDisplayWindowGUI::drawContents(), and mrpt::gui::MRPT2NanoguiGLCanvas::drawGL().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateLastPos()

void CGlCanvasBase::updateLastPos ( int  x,
int  y 
)
inherited

Sets the last mouse position.

Definition at line 133 of file CGlCanvasBase.cpp.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent().

Here is the caller graph for this function:

◆ updateOrbitCamera()

void CGlCanvasBase::updateOrbitCamera ( CamaraParams params,
int  x,
int  y 
) const
inherited

This function for the mouse event It gets a reference to CamaraParams, x, y and updates the elevation and azimuth.

See also getElevationDegrees(), getAzimuthDegrees()

Definition at line 124 of file CGlCanvasBase.cpp.

References mouseGlitchFilter(), and params.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePan()

void CGlCanvasBase::updatePan ( CamaraParams params,
int  x,
int  y 
) const
inherited

This function for the mouse event It gets a reference to CamaraParams, x, y and updates the pointing of the camera.

See also getCameraPointingX(), getCameraPointingY(), getCameraPointingZ()

Definition at line 155 of file CGlCanvasBase.cpp.

References mrpt::DEG2RAD(), and params.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRotate()

void CGlCanvasBase::updateRotate ( CamaraParams params,
int  x,
int  y 
) const
inherited

This function for the mouse event It gets a reference to CamaraParams, x, y and updates the elevation and azimuth.

See also getElevationDegrees(), getAzimuthDegrees()

Definition at line 92 of file CGlCanvasBase.cpp.

References mrpt::DEG2RAD(), mouseGlitchFilter(), and params.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateZoom() [1/2]

void CGlCanvasBase::updateZoom ( CamaraParams params,
int  x,
int  y 
) const
inherited

This function for the mouse event It gets a reference to CamaraParams, x, y and updates the zoom of the CameraParams.

See also updateZoom(CamaraParams &, float)

Definition at line 62 of file CGlCanvasBase.cpp.

References params.

Referenced by mrpt::gui::internal::NanoGUICanvasHeadless::mouseMotionEvent(), and mrpt::gui::internal::NanoGUICanvasHeadless::scrollEvent().

Here is the caller graph for this function:

◆ updateZoom() [2/2]

void CGlCanvasBase::updateZoom ( CamaraParams params,
float  delta 
) const
inherited

This function for the wheel event It gets a reference to CamaraParams, delta and updates the zoom of the CameraParams.

See also updateZoom(CamaraParams &, int, int)

Definition at line 74 of file CGlCanvasBase.cpp.

References params.

Member Data Documentation

◆ SENSIBILITY_DEG_PER_PIXEL

float CGlCanvasBase::SENSIBILITY_DEG_PER_PIXEL = 0.1f
staticinherited

Definition at line 187 of file CGlCanvasBase.h.




Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020