Visual Servoing Platform
version 3.6.1 under development (2024-12-17)
|
#include <visp3/ar/vpPanda3DGeometryRenderer.h>
Public Types | |
enum | vpRenderType { OBJECT_NORMALS , CAMERA_NORMALS } |
Public Member Functions | |
vpPanda3DGeometryRenderer (vpRenderType renderType) | |
~vpPanda3DGeometryRenderer ()=default | |
void | getRender (vpImage< vpRGBf > &colorData, vpImage< float > &depth) const |
void | getRender (vpImage< vpRGBf > &normals, vpImage< float > &depth, const vpRect &bb, unsigned int h, unsigned w) const |
void | getRender (vpImage< vpRGBf > &colorData) const |
void | getRender (vpImage< float > &depth) const |
GraphicsOutput * | getMainOutputBuffer () VP_OVERRIDE |
virtual void | initFramework () |
virtual void | initFromParent (std::shared_ptr< PandaFramework > framework, PointerTo< WindowFramework > window) |
virtual void | initFromParent (const vpPanda3DBaseRenderer &renderer) |
virtual void | beforeFrameRendered () |
virtual void | renderFrame () |
virtual void | afterFrameRendered () |
const std::string & | getName () const |
void | setName (const std::string &name) |
NodePath & | getRenderRoot () |
virtual void | setRenderParameters (const vpPanda3DRenderParameters ¶ms) |
virtual bool | isRendering3DScene () const |
int | getRenderOrder () const |
void | setRenderOrder (int order) |
virtual void | setCameraPose (const vpHomogeneousMatrix &wTc) |
virtual vpHomogeneousMatrix | getCameraPose () |
virtual void | setNodePose (const std::string &name, const vpHomogeneousMatrix &wTo) |
virtual void | setNodePose (NodePath &object, const vpHomogeneousMatrix &wTo) |
virtual vpHomogeneousMatrix | getNodePose (const std::string &name) |
virtual vpHomogeneousMatrix | getNodePose (NodePath &object) |
void | computeNearAndFarPlanesFromNode (const std::string &name, float &near, float &far, bool fast) |
NodePath | loadObject (const std::string &nodeName, const std::string &modelPath) |
virtual void | addNodeToScene (const NodePath &object) |
void | setVerticalSyncEnabled (bool useVsync) |
void | setAbortOnPandaError (bool abort) |
void | enableDebugLog () |
void | printStructure () |
virtual void | enableSharedDepthBuffer (vpPanda3DBaseRenderer &sourceBuffer) |
Static Public Member Functions | |
static vpColVector | vispPointToPanda (const vpColVector &point) |
static vpColVector | vispVectorToPanda (const vpColVector &vec) |
Protected Member Functions | |
void | setupScene () VP_OVERRIDE |
void | setupRenderTarget () VP_OVERRIDE |
virtual void | setupCamera () |
Protected Attributes | |
std::string | m_name |
int | m_renderOrder |
std::shared_ptr< PandaFramework > | m_framework |
PointerTo< WindowFramework > | m_window |
vpPanda3DRenderParameters | m_renderParameters |
NodePath | m_renderRoot |
PointerTo< Camera > | m_camera |
NodePath | m_cameraPath |
std::vector< GraphicsOutput * > | m_buffers |
Static Protected Attributes | |
static const vpHomogeneousMatrix | VISP_T_PANDA |
static const vpHomogeneousMatrix | PANDA_T_VISP |
Renderer that outputs object geometric information.
This information may contain, depending on requested render type:
Definition at line 53 of file vpPanda3DGeometryRenderer.h.
Enumerator | |
---|---|
OBJECT_NORMALS | |
CAMERA_NORMALS | Surface normals in the object frame. |
Definition at line 57 of file vpPanda3DGeometryRenderer.h.
vpPanda3DGeometryRenderer::vpPanda3DGeometryRenderer | ( | vpRenderType | renderType | ) |
Definition at line 94 of file vpPanda3DGeometryRenderer.cpp.
|
default |
|
virtualinherited |
Add a node to the scene. Its pose is set as the identity matrix.
object |
Reimplemented in vpPanda3DRGBRenderer, and vpPanda3DRendererSet.
Definition at line 286 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_renderRoot, and vpPanda3DBaseRenderer::setNodePose().
|
inlinevirtualinherited |
Reimplemented in vpPanda3DRendererSet, and vpPanda3DPostProcessFilter.
Definition at line 79 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DPostProcessFilter::afterFrameRendered(), and vpPanda3DBaseRenderer::renderFrame().
|
inlinevirtualinherited |
Reimplemented in vpPanda3DRendererSet.
Definition at line 77 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::renderFrame().
|
inherited |
Compute the near and far planes for the camera at the current pose, given a certain node/part of the graph.
The near clipping value will be set to the distance to the closest point of the object. The far clipping value will be set to the distance to farthest vertex of the object.
name | name of the node that should be used to compute near and far values. |
near | resulting near clipping plane distance |
far | resulting far clipping plane distance |
fast | Whether to use the axis align bounding box to compute the clipping planes. This is faster than reprojecting the full geometry in the camera frame |
Definition at line 191 of file vpPanda3DBaseRenderer.cpp.
References vpException::badValue, vpException::fatalError, vpPanda3DBaseRenderer::getCameraPose(), vpPanda3DBaseRenderer::getNodePose(), vpHomogeneousMatrix::inverse(), vpPanda3DBaseRenderer::m_camera, vpPanda3DBaseRenderer::m_cameraPath, vpPanda3DBaseRenderer::m_renderRoot, vpException::notInitialized, and vpPanda3DBaseRenderer::PANDA_T_VISP.
|
inherited |
Definition at line 312 of file vpPanda3DBaseRenderer.cpp.
|
virtualinherited |
Reimplemented in vpPanda3DRendererSet.
Definition at line 261 of file vpPanda3DBaseRenderer.cpp.
References vpException::fatalError, vpPanda3DBaseRenderer::getMainOutputBuffer(), and vpPanda3DBaseRenderer::isRendering3DScene().
|
virtualinherited |
Retrieve the camera's pose, in the world frame. The pose is specified using the ViSP convention (Y-down right handed).
Reimplemented in vpPanda3DRendererSet.
Definition at line 150 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::getNodePose(), vpPanda3DBaseRenderer::m_camera, vpPanda3DBaseRenderer::m_cameraPath, and vpException::notInitialized.
Referenced by vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode().
|
inlinevirtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 88 of file vpPanda3DGeometryRenderer.h.
|
inlineinherited |
Get the name of the renderer.
Definition at line 92 of file vpPanda3DBaseRenderer.h.
|
virtualinherited |
Get the pose of a Panda node, in world frame in the ViSP convention (Y-down right handed).
name | Node path to search for. |
if | no node can be found from the given path. |
Reimplemented in vpPanda3DRendererSet.
Definition at line 173 of file vpPanda3DBaseRenderer.cpp.
References vpException::badValue, and vpPanda3DBaseRenderer::m_renderRoot.
Referenced by vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode(), and vpPanda3DBaseRenderer::getCameraPose().
|
virtualinherited |
Get the pose of a Panda node, in world frame in the ViSP convention (Y-down right handed). This version of the method directly uses the Panda Nodepath.
Reimplemented in vpPanda3DRendererSet.
Definition at line 182 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::PANDA_T_VISP.
void vpPanda3DGeometryRenderer::getRender | ( | vpImage< float > & | depth | ) | const |
Get render results into ViSP readable structures. This version only retrieves the depth data.
depth | Depending on the vpRenderType, rendered depth may be stored in this image. |
Definition at line 243 of file vpPanda3DGeometryRenderer.cpp.
References vpException::badValue, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpImage< Type >::resize().
Get render results into ViSP readable structures. This version only retrieves the normal data.
colorData | Depending on the vpRenderType, normals in the world or camera frame may be stored in this image. |
Definition at line 221 of file vpPanda3DGeometryRenderer.cpp.
References vpRGBf::B, vpException::badValue, vpRGBf::G, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpRGBf::R, and vpImage< Type >::resize().
void vpPanda3DGeometryRenderer::getRender | ( | vpImage< vpRGBf > & | colorData, |
vpImage< float > & | depth | ||
) | const |
Get render results into ViSP readable structures.
colorData | Depending on the vpRenderType, normals in the world or camera frame may be stored in this image. |
depth | Image used to store depth |
Definition at line 158 of file vpPanda3DGeometryRenderer.cpp.
References vpRGBf::B, vpException::badValue, vpRGBf::G, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpRGBf::R, and vpImage< Type >::resize().
void vpPanda3DGeometryRenderer::getRender | ( | vpImage< vpRGBf > & | normals, |
vpImage< float > & | depth, | ||
const vpRect & | bb, | ||
unsigned int | h, | ||
unsigned | w | ||
) | const |
Definition at line 184 of file vpPanda3DGeometryRenderer.cpp.
References vpRGBf::B, vpException::dimensionError, vpRGBf::G, vpImage< Type >::getHeight(), vpPanda3DRenderParameters::getImageHeight(), vpPanda3DRenderParameters::getImageWidth(), vpRect::getLeft(), vpRect::getTop(), vpImage< Type >::getWidth(), vpPanda3DBaseRenderer::m_renderParameters, vpRGBf::R, and vpImage< Type >::resize().
|
inlineinherited |
Get the rendering order of this renderer. If a renderer A has a lower order value than B, it will be rendered before B. This is useful, if for instance, B is a postprocessing filter that depends on the result of B.
Definition at line 123 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DPostProcessFilter::vpPanda3DPostProcessFilter().
|
inlineinherited |
Get the scene root.
Definition at line 100 of file vpPanda3DBaseRenderer.h.
|
virtualinherited |
Initialize the whole Panda3D framework. Create a new PandaFramework object and a new window.
Will also perform the renderer setup (scene, camera and render targets)
Reimplemented in vpPanda3DRendererSet.
Definition at line 51 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DRenderParameters::getImageHeight(), vpPanda3DRenderParameters::getImageWidth(), vpPanda3DBaseRenderer::m_framework, vpPanda3DBaseRenderer::m_renderParameters, vpPanda3DBaseRenderer::m_window, vpException::notImplementedError, vpException::notInitialized, vpPanda3DBaseRenderer::setupCamera(), vpPanda3DBaseRenderer::setupRenderTarget(), and vpPanda3DBaseRenderer::setupScene().
|
virtualinherited |
Reimplemented in vpPanda3DRendererSet.
Definition at line 88 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::initFromParent(), vpPanda3DBaseRenderer::m_framework, and vpPanda3DBaseRenderer::m_window.
|
virtualinherited |
Reimplemented in vpPanda3DRendererSet.
Definition at line 79 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_framework, vpPanda3DBaseRenderer::m_window, vpPanda3DBaseRenderer::setupCamera(), vpPanda3DBaseRenderer::setupRenderTarget(), and vpPanda3DBaseRenderer::setupScene().
Referenced by vpPanda3DBaseRenderer::initFromParent(), and vpPanda3DRendererSet::initFromParent().
|
inlinevirtualinherited |
Returns true if this renderer process 3D data and its scene root can be interacted with.
This value could be false, if for instance it is redefined in a subclass that performs postprocessing on a texture.
Reimplemented in vpPanda3DPostProcessFilter.
Definition at line 114 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::enableSharedDepthBuffer(), vpPanda3DRendererSet::getCameraPose(), and vpPanda3DRendererSet::getNodePose().
|
inherited |
Load a 3D object. To load an .obj file, Panda3D must be compiled with assimp support.
Once loaded, the object will not be visible, it should be added to the scene.
nodeName | the name that will be used when inserting the node in the scene graph |
modelPath | Path to the model file |
Definition at line 274 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_framework, and vpPanda3DBaseRenderer::m_window.
|
inherited |
Definition at line 330 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_renderRoot.
|
virtualinherited |
Definition at line 109 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::afterFrameRendered(), vpPanda3DBaseRenderer::beforeFrameRendered(), and vpPanda3DBaseRenderer::m_framework.
|
inherited |
Set the behaviour when a Panda3D assertion fails. If abort is true, the program will stop. Otherwise, an error will be displayed in the console.
abort | whether to abort (true) or display a message when an assertion fails. |
Definition at line 302 of file vpPanda3DBaseRenderer.cpp.
|
virtualinherited |
Set the camera's pose. The pose is specified using the ViSP convention (Y-down right handed).
wTc | the new pose of the camera, in world frame |
Reimplemented in vpPanda3DRendererSet.
Definition at line 142 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_camera, vpPanda3DBaseRenderer::m_cameraPath, vpException::notInitialized, and vpPanda3DBaseRenderer::setNodePose().
|
inlineinherited |
Definition at line 94 of file vpPanda3DBaseRenderer.h.
|
virtualinherited |
Set the pose of a node. This node can be any Panda object (light, mesh, camera). The pose is specified using the ViSP convention (Y-down right handed).
name | Node path to search for, from the render root. This is the object that will be modified See https://docs.panda3d.org/1.10/python/programming/scene-graph/searching-scene-graph |
wTo | Pose of the object in the world frame |
if | the corresponding node cannot be found. |
Reimplemented in vpPanda3DRendererSet.
Definition at line 158 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_renderRoot.
Referenced by vpPanda3DBaseRenderer::addNodeToScene(), vpPanda3DRGBRenderer::addNodeToScene(), and vpPanda3DBaseRenderer::setCameraPose().
|
virtualinherited |
Set the pose of a node. The pose is specified using the ViSP convention (Y-down right handed). This node can be any Panda object (light, mesh, camera).
object | The object for which to set the pose |
wTo | Pose of the object in the world frame |
Reimplemented in vpPanda3DRendererSet.
Definition at line 164 of file vpPanda3DBaseRenderer.cpp.
References vpHomogeneousMatrix::getRotationMatrix(), vpHomogeneousMatrix::getTranslationVector(), vpPanda3DBaseRenderer::VISP_T_PANDA, vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), and vpQuaternionVector::z().
|
inlineinherited |
Definition at line 125 of file vpPanda3DBaseRenderer.h.
|
virtualinherited |
Set new rendering parameters. If the scene has already been initialized, the renderer camera is updated.
params | the new rendering parameters |
Reimplemented in vpPanda3DRendererSet, and vpPanda3DPostProcessFilter.
Definition at line 116 of file vpPanda3DBaseRenderer.cpp.
References vpException::fatalError, vpPanda3DRenderParameters::getImageHeight(), vpPanda3DRenderParameters::getImageWidth(), vpPanda3DBaseRenderer::m_buffers, vpPanda3DBaseRenderer::m_camera, vpPanda3DBaseRenderer::m_renderParameters, and vpPanda3DRenderParameters::setupPandaCamera().
|
protectedvirtualinherited |
Initialize camera. Should be called when the scene root of this render has already been created.
Reimplemented in vpPanda3DRendererSet, and vpPanda3DPostProcessFilter.
Definition at line 99 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_camera, vpPanda3DBaseRenderer::m_cameraPath, vpPanda3DBaseRenderer::m_renderParameters, vpPanda3DBaseRenderer::m_renderRoot, vpPanda3DBaseRenderer::m_window, and vpPanda3DRenderParameters::setupPandaCamera().
Referenced by vpPanda3DBaseRenderer::initFramework(), and vpPanda3DBaseRenderer::initFromParent().
|
protectedvirtual |
Initialize buffers and other objects that are required to save the render.
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 113 of file vpPanda3DGeometryRenderer.cpp.
References vpException::fatalError, vpPanda3DRenderParameters::getImageHeight(), vpPanda3DRenderParameters::getImageWidth(), vpPanda3DBaseRenderer::m_buffers, vpPanda3DBaseRenderer::m_cameraPath, vpPanda3DBaseRenderer::m_renderOrder, vpPanda3DBaseRenderer::m_renderParameters, and vpPanda3DBaseRenderer::m_window.
|
protectedvirtual |
Initialize the scene for this specific renderer.
Creates a root scene for this node and applies shaders. that will be used for rendering
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 96 of file vpPanda3DGeometryRenderer.cpp.
References CAMERA_NORMALS, vpPanda3DBaseRenderer::m_name, vpPanda3DBaseRenderer::m_renderRoot, vpPanda3DBaseRenderer::m_window, and OBJECT_NORMALS.
|
inherited |
set whether vertical sync is enabled. When vertical sync is enabled, render speed will be limited by the display's refresh rate
useVsync | Whether to use vsync or not |
Definition at line 293 of file vpPanda3DBaseRenderer.cpp.
|
staticinherited |
Definition at line 318 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::PANDA_T_VISP.
|
staticinherited |
Definition at line 324 of file vpPanda3DBaseRenderer.cpp.
References vpHomogeneousMatrix::getRotationMatrix(), and vpPanda3DBaseRenderer::PANDA_T_VISP.
Referenced by vpPanda3DDirectionalLight::addToScene().
|
protectedinherited |
NodePath of the camera.
Definition at line 279 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::setRenderParameters(), vpPanda3DPostProcessFilter::setRenderParameters(), setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), and vpPanda3DRGBRenderer::setupRenderTarget().
|
protectedinherited |
Node containing all the objects and the camera for this renderer.
Definition at line 277 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode(), vpPanda3DBaseRenderer::getCameraPose(), vpPanda3DBaseRenderer::setCameraPose(), vpPanda3DBaseRenderer::setRenderParameters(), vpPanda3DBaseRenderer::setupCamera(), and vpPanda3DPostProcessFilter::setupCamera().
|
protectedinherited |
Definition at line 278 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode(), vpPanda3DBaseRenderer::getCameraPose(), vpPanda3DBaseRenderer::setCameraPose(), vpPanda3DBaseRenderer::setupCamera(), vpPanda3DPostProcessFilter::setupCamera(), setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), and vpPanda3DRGBRenderer::setupRenderTarget().
|
protectedinherited |
Rendering priority for this renderer and its buffers. A lower value will be rendered first. Should be used when calling make_output in setupRenderTarget()
Definition at line 273 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DRendererSet::addSubRenderer(), vpPanda3DBaseRenderer::initFramework(), vpPanda3DRendererSet::initFramework(), vpPanda3DBaseRenderer::initFromParent(), vpPanda3DRendererSet::initFromParent(), vpPanda3DBaseRenderer::loadObject(), and vpPanda3DBaseRenderer::renderFrame().
|
protectedinherited |
Inverse of VISP_T_PANDA.
Definition at line 271 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DPostProcessFilter::setupRenderTarget(), vpPanda3DBaseRenderer::setupScene(), and setupScene().
|
protectedinherited |
name of the renderer
Definition at line 272 of file vpPanda3DBaseRenderer.h.
Referenced by setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), and vpPanda3DRGBRenderer::setupRenderTarget().
|
protectedinherited |
Pointer to owning window, which can create buffers etc. It is not necessarily visible.
Definition at line 275 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DRendererSet::addSubRenderer(), getRender(), vpPanda3DPostProcessFilter::getRenderBasic(), vpPanda3DBaseRenderer::initFramework(), vpPanda3DRendererSet::initFramework(), vpPanda3DBaseRenderer::setRenderParameters(), vpPanda3DPostProcessFilter::setRenderParameters(), vpPanda3DRendererSet::setRenderParameters(), vpPanda3DBaseRenderer::setupCamera(), setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), vpPanda3DRGBRenderer::setupRenderTarget(), and vpPanda3DRendererSet::vpPanda3DRendererSet().
|
protectedinherited |
Rendering parameters.
Definition at line 276 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::addNodeToScene(), vpPanda3DRGBRenderer::addNodeToScene(), vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode(), vpPanda3DBaseRenderer::getNodePose(), vpPanda3DBaseRenderer::printStructure(), vpPanda3DCanny::setEdgeThreshold(), vpPanda3DBaseRenderer::setNodePose(), vpPanda3DPostProcessFilter::setRenderParameters(), vpPanda3DBaseRenderer::setupCamera(), vpPanda3DPostProcessFilter::setupCamera(), vpPanda3DBaseRenderer::setupScene(), vpPanda3DCanny::setupScene(), setupScene(), vpPanda3DPostProcessFilter::setupScene(), and vpPanda3DRGBRenderer::setupScene().
|
protectedinherited |
Pointer to the active panda framework.
Definition at line 274 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DRendererSet::addSubRenderer(), vpPanda3DBaseRenderer::initFramework(), vpPanda3DRendererSet::initFramework(), vpPanda3DBaseRenderer::initFromParent(), vpPanda3DRendererSet::initFromParent(), vpPanda3DBaseRenderer::loadObject(), vpPanda3DPostProcessFilter::setRenderParameters(), vpPanda3DBaseRenderer::setupCamera(), vpPanda3DPostProcessFilter::setupCamera(), setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), vpPanda3DRGBRenderer::setupRenderTarget(), vpPanda3DBaseRenderer::setupScene(), and setupScene().
|
staticprotectedinherited |
Homogeneous transformation matrix to convert from the Panda coordinate system (right-handed Z-up) to the ViSP coordinate system (right-handed Y-Down)
Definition at line 268 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::computeNearAndFarPlanesFromNode(), vpPanda3DBaseRenderer::getNodePose(), vpPanda3DBaseRenderer::vispPointToPanda(), and vpPanda3DBaseRenderer::vispVectorToPanda().
|
staticprotectedinherited |
Definition at line 267 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::setNodePose().