![]() |
Visual Servoing Platform
version 3.6.1 under development (2024-09-08)
|
#include <visp3/ar/vpPanda3DRendererSet.h>
Public Member Functions | |
vpPanda3DRendererSet (const vpPanda3DRenderParameters &renderParameters) | |
virtual | ~vpPanda3DRendererSet ()=default |
void | initFramework () VP_OVERRIDE |
void | initFromParent (std::shared_ptr< PandaFramework > framework, PointerTo< WindowFramework > window) VP_OVERRIDE |
void | initFromParent (const vpPanda3DBaseRenderer &renderer) VP_OVERRIDE |
void | setCameraPose (const vpHomogeneousMatrix &wTc) VP_OVERRIDE |
vpHomogeneousMatrix | getCameraPose () VP_OVERRIDE |
void | setNodePose (const std::string &name, const vpHomogeneousMatrix &wTo) VP_OVERRIDE |
void | setNodePose (NodePath &object, const vpHomogeneousMatrix &wTo) VP_OVERRIDE |
vpHomogeneousMatrix | getNodePose (const std::string &name) VP_OVERRIDE |
vpHomogeneousMatrix | getNodePose (NodePath &object) VP_OVERRIDE |
void | addNodeToScene (const NodePath &object) VP_OVERRIDE |
virtual void | setRenderParameters (const vpPanda3DRenderParameters ¶ms) VP_OVERRIDE |
void | addLight (const vpPanda3DLight &light) VP_OVERRIDE |
void | addSubRenderer (std::shared_ptr< vpPanda3DBaseRenderer > renderer) |
void | enableSharedDepthBuffer (vpPanda3DBaseRenderer &sourceBuffer) VP_OVERRIDE |
template<typename RendererType > | |
std::shared_ptr< RendererType > | getRenderer () |
template<typename RendererType > | |
std::shared_ptr< RendererType > | getRenderer (const std::string &name) |
void | beforeFrameRendered () VP_OVERRIDE |
void | afterFrameRendered () VP_OVERRIDE |
virtual void | renderFrame () |
const std::string & | getName () const |
void | setName (const std::string &name) |
NodePath & | getRenderRoot () |
virtual bool | isRendering3DScene () const |
int | getRenderOrder () const |
void | setRenderOrder (int order) |
void | computeNearAndFarPlanesFromNode (const std::string &name, float &near, float &far, bool fast) |
NodePath | loadObject (const std::string &nodeName, const std::string &modelPath) |
void | setVerticalSyncEnabled (bool useVsync) |
void | setAbortOnPandaError (bool abort) |
void | enableDebugLog () |
void | printStructure () |
virtual GraphicsOutput * | getMainOutputBuffer () |
Static Public Member Functions | |
static vpColVector | vispPointToPanda (const vpColVector &point) |
static vpColVector | vispVectorToPanda (const vpColVector &vec) |
Protected Member Functions | |
void | setupScene () VP_OVERRIDE |
void | setupCamera () VP_OVERRIDE |
virtual void | setupRenderTarget () |
Protected Attributes | |
std::vector< std::shared_ptr< vpPanda3DBaseRenderer > > | m_subRenderers |
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 |
Class that rendering multiple datatypes, in a single pass. A RendererSet contains multiple subrenderers, all inheriting from vpPanda3DBaseRenderer. The renderer set synchronizes all scene properties for the different subrenderers. This includes:
The overall usage workflow is the following:
rendererSet.getRenderer<RendererType>("MyRendererName").getRender(I)
where RendererType is the relevant subclass of vpPanda3DBaseRenderer and "MyRendererName" its name (see vpPanda3DBaseRenderer::getName) Definition at line 60 of file vpPanda3DRendererSet.h.
BEGIN_VISP_NAMESPACE vpPanda3DRendererSet::vpPanda3DRendererSet | ( | const vpPanda3DRenderParameters & | renderParameters | ) |
Definition at line 38 of file vpPanda3DRendererSet.cpp.
References vpPanda3DBaseRenderer::m_renderParameters.
|
virtualdefault |
|
virtual |
Light this lightable object with a new light.
light |
Implements vpPanda3DLightable.
Definition at line 155 of file vpPanda3DRendererSet.cpp.
References vpPanda3DLightable::addLight(), and m_subRenderers.
|
virtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 138 of file vpPanda3DRendererSet.cpp.
References m_subRenderers.
void vpPanda3DRendererSet::addSubRenderer | ( | std::shared_ptr< vpPanda3DBaseRenderer > | renderer | ) |
Add a new subrenderer: This subrenderer should have a unique name, not present in the set.
if | the subrenderer's name is already present in the set. |
renderer | the renderer to add |
Definition at line 165 of file vpPanda3DRendererSet.cpp.
References vpException::badValue, getCameraPose(), vpPanda3DBaseRenderer::m_framework, vpPanda3DBaseRenderer::m_renderParameters, m_subRenderers, and vpPanda3DBaseRenderer::m_window.
|
inlinevirtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 200 of file vpPanda3DRendererSet.h.
|
inlinevirtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 193 of file vpPanda3DRendererSet.h.
|
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, vpTime::measureTimeMs(), vpException::notInitialized, and vpPanda3DBaseRenderer::PANDA_T_VISP.
|
inherited |
Definition at line 313 of file vpPanda3DBaseRenderer.cpp.
|
virtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 188 of file vpPanda3DRendererSet.cpp.
References m_subRenderers.
|
virtual |
Retrieve the pose of the camera. As this renderer contains multiple other renderers.
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 97 of file vpPanda3DRendererSet.cpp.
References vpException::fatalError, vpPanda3DBaseRenderer::isRendering3DScene(), and m_subRenderers.
Referenced by addSubRenderer().
|
inlinevirtualinherited |
Reimplemented in vpPanda3DRGBRenderer, vpPanda3DPostProcessFilter, and vpPanda3DGeometryRenderer.
Definition at line 241 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::enableSharedDepthBuffer().
|
inlineinherited |
Get the name of the renderer.
Definition at line 92 of file vpPanda3DBaseRenderer.h.
|
virtual |
Retrieve the pose of a scene node. The pose is in the world frame, using a ViSP convention.
name | name of the node |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 122 of file vpPanda3DRendererSet.cpp.
References vpException::fatalError, vpPanda3DBaseRenderer::isRendering3DScene(), and m_subRenderers.
|
virtual |
This method is not supported for this renderer type. Use the std::string version.
vpException,as | this method is not supported |
object |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 133 of file vpPanda3DRendererSet.cpp.
References vpException::badValue.
|
inline |
Retrieve the first subrenderer with the specified template type.
RendererType | The type of the renderer to find |
Definition at line 161 of file vpPanda3DRendererSet.h.
|
inline |
Retrieve the subrenderer with the specified template type and the given name.
name | the name of the subrenderer to find |
RendererType | The type of the renderer to find |
Definition at line 180 of file vpPanda3DRendererSet.h.
|
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.
|
virtual |
Initialize the framework and propagate the created panda3D framework to the subrenderers.
The subrenderers will be initialized in the order of their priority as defined by vpPanda3DBaseRenderer::getRenderOrder Thus, if a renderer B depends on A for its render, and if B.getRenderOrder() > A.getRenderOrder() it can rely on A being initialized when B.initFromParent is called (along with the setupCamera, setupRenderTarget).
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 46 of file vpPanda3DRendererSet.cpp.
References vpException::fatalError, vpPanda3DRenderParameters::getImageHeight(), vpPanda3DRenderParameters::getImageWidth(), vpPanda3DBaseRenderer::m_framework, vpPanda3DBaseRenderer::m_renderParameters, m_subRenderers, vpPanda3DBaseRenderer::m_window, and vpException::notImplementedError.
|
virtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 80 of file vpPanda3DRendererSet.cpp.
References vpPanda3DBaseRenderer::initFromParent(), and m_subRenderers.
|
virtual |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 72 of file vpPanda3DRendererSet.cpp.
References vpPanda3DBaseRenderer::initFromParent(), vpPanda3DBaseRenderer::m_framework, m_subRenderers, and vpPanda3DBaseRenderer::m_window.
|
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(), getCameraPose(), and 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 275 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::m_framework, and vpPanda3DBaseRenderer::m_window.
|
inherited |
Definition at line 331 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 303 of file vpPanda3DBaseRenderer.cpp.
|
virtual |
Set the pose of the camera, using the ViSP convention. This change is propagated to all subrenderers.
wTc | Pose of the camera |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 88 of file vpPanda3DRendererSet.cpp.
References m_subRenderers.
|
inlineinherited |
Definition at line 94 of file vpPanda3DBaseRenderer.h.
|
virtual |
Set the pose of an object for all the subrenderers. The pose is specified using the ViSP convention This method may fail if a subrenderer does not have a node with the given name.
name | |
wTo |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 108 of file vpPanda3DRendererSet.cpp.
References m_subRenderers.
|
virtual |
This method is not supported for this renderer type. Use the std::string version.
vpException,as | this method is not supported |
object | |
wTo |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 117 of file vpPanda3DRendererSet.cpp.
References vpException::badValue.
|
inlineinherited |
Definition at line 125 of file vpPanda3DBaseRenderer.h.
|
virtual |
Set new rendering parameters. If the scene has already been initialized, the renderer camera is updated.
params | the new rendering parameters |
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 147 of file vpPanda3DRendererSet.cpp.
References vpPanda3DBaseRenderer::m_renderParameters, and m_subRenderers.
|
inlineprotectedvirtual |
Initialize camera. Should be called when the scene root of this render has already been created.
Reimplemented from vpPanda3DBaseRenderer.
Definition at line 210 of file vpPanda3DRendererSet.h.
|
inlineprotectedvirtualinherited |
Initialize buffers and other objects that are required to save the render.
Reimplemented in vpPanda3DRGBRenderer, vpPanda3DPostProcessFilter, and vpPanda3DGeometryRenderer.
Definition at line 265 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DBaseRenderer::initFramework(), and vpPanda3DBaseRenderer::initFromParent().
|
inlineprotectedvirtual |
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 208 of file vpPanda3DRendererSet.h.
|
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 294 of file vpPanda3DBaseRenderer.cpp.
|
staticinherited |
Definition at line 319 of file vpPanda3DBaseRenderer.cpp.
References vpPanda3DBaseRenderer::PANDA_T_VISP.
|
staticinherited |
Definition at line 325 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(), vpPanda3DGeometryRenderer::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(), vpPanda3DGeometryRenderer::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 addSubRenderer(), vpPanda3DBaseRenderer::initFramework(), initFramework(), vpPanda3DBaseRenderer::initFromParent(), 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 vpPanda3DGeometryRenderer::setupScene().
|
protectedinherited |
name of the renderer
Definition at line 272 of file vpPanda3DBaseRenderer.h.
Referenced by vpPanda3DGeometryRenderer::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 addSubRenderer(), vpPanda3DGeometryRenderer::getRender(), vpPanda3DPostProcessFilter::getRenderBasic(), vpPanda3DBaseRenderer::initFramework(), initFramework(), vpPanda3DBaseRenderer::setRenderParameters(), vpPanda3DPostProcessFilter::setRenderParameters(), setRenderParameters(), vpPanda3DBaseRenderer::setupCamera(), vpPanda3DGeometryRenderer::setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), vpPanda3DRGBRenderer::setupRenderTarget(), and 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(), vpPanda3DGeometryRenderer::setupScene(), vpPanda3DPostProcessFilter::setupScene(), and vpPanda3DRGBRenderer::setupScene().
|
protected |
Definition at line 212 of file vpPanda3DRendererSet.h.
Referenced by addLight(), addNodeToScene(), addSubRenderer(), enableSharedDepthBuffer(), getCameraPose(), getNodePose(), initFramework(), initFromParent(), setCameraPose(), setNodePose(), and setRenderParameters().
|
protectedinherited |
Pointer to the active panda framework.
Definition at line 274 of file vpPanda3DBaseRenderer.h.
Referenced by addSubRenderer(), vpPanda3DBaseRenderer::initFramework(), initFramework(), vpPanda3DBaseRenderer::initFromParent(), initFromParent(), vpPanda3DBaseRenderer::loadObject(), vpPanda3DPostProcessFilter::setRenderParameters(), vpPanda3DBaseRenderer::setupCamera(), vpPanda3DPostProcessFilter::setupCamera(), vpPanda3DGeometryRenderer::setupRenderTarget(), vpPanda3DPostProcessFilter::setupRenderTarget(), vpPanda3DRGBRenderer::setupRenderTarget(), vpPanda3DBaseRenderer::setupScene(), and vpPanda3DGeometryRenderer::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().