From a5e69732cb558fafbb0a5b059959994ed33c4932 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Fri, 15 Nov 2024 18:37:02 +0100 Subject: [PATCH] Update vpPanda3DRendererSet class - introduce a default constructor - update class main doc --- .../ar/include/visp3/ar/vpPanda3DRendererSet.h | 16 ++++++++++++---- .../panda3d-simulator/vpPanda3DRendererSet.cpp | 7 +++++++ tutorial/ar/tutorial-panda3d-renderer.cpp | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/ar/include/visp3/ar/vpPanda3DRendererSet.h b/modules/ar/include/visp3/ar/vpPanda3DRendererSet.h index 49098952cf..d64ad49424 100644 --- a/modules/ar/include/visp3/ar/vpPanda3DRendererSet.h +++ b/modules/ar/include/visp3/ar/vpPanda3DRendererSet.h @@ -44,7 +44,8 @@ BEGIN_VISP_NAMESPACE /** * \ingroup group_ar_renderer_panda3d * - * @brief Class that rendering multiple datatypes, in a single pass. A RendererSet contains multiple subrenderers, all inheriting from vpPanda3DBaseRenderer. + * @brief Class that renders multiple datatypes, in a single pass. + * A renderer set contains multiple subrenderers, all inheriting from vpPanda3DBaseRenderer. * The renderer set synchronizes all scene properties for the different subrenderers. This includes: * * The camera properties (intrinsics, resolution) and extrinsics * * The pose and properties of every object in the scene @@ -53,13 +54,20 @@ BEGIN_VISP_NAMESPACE * The overall usage workflow is the following: * 1. Create vpPanda3DRendererSet instance * 2. Create the subrenderers (e.g, vpPanda3DGeometryRenderer) - * 3. Add the subrenderers to the set with addSubRenderer - * 4. Call renderFrame() on the rendererSet. Each subrenderer now has its output computed and ready to be retrieved - * 5. Retrieve relevant outputs in ViSP format with something similar to `rendererSet.getRenderer("MyRendererName").getRender(I)` where RendererType is the relevant subclass of vpPanda3DBaseRenderer and "MyRendererName" its name (see vpPanda3DBaseRenderer::getName) + * 3. Add the subrenderers to the set with addSubRenderer() + * 4. Call renderFrame() on the renderer set. Each subrenderer now has its output computed and ready + * to be retrieved + * 5. Retrieve relevant outputs in ViSP format with something similar to + * \code + * rendererSet.getRenderer("MyRendererName").getRender(I) + * \endcode + * where `RendererType` is the relevant subclass of vpPanda3DBaseRenderer and `"MyRendererName"` + * its name (see vpPanda3DBaseRenderer::getName()) */ class VISP_EXPORT vpPanda3DRendererSet : public vpPanda3DBaseRenderer, public vpPanda3DLightable { public: + vpPanda3DRendererSet(); vpPanda3DRendererSet(const vpPanda3DRenderParameters &renderParameters); virtual ~vpPanda3DRendererSet() = default; diff --git a/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp b/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp index 576c9bf5f3..e50d7293e7 100644 --- a/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp +++ b/modules/ar/src/panda3d-simulator/vpPanda3DRendererSet.cpp @@ -35,6 +35,13 @@ #include "load_prc_file.h" BEGIN_VISP_NAMESPACE +vpPanda3DRendererSet::vpPanda3DRendererSet() : vpPanda3DBaseRenderer("set") +{ + load_prc_file_data("", "textures-power-2 none"); + load_prc_file_data("", "gl-version 3 2"); + load_prc_file_data("", "no-singular-invert"); +} + vpPanda3DRendererSet::vpPanda3DRendererSet(const vpPanda3DRenderParameters &renderParameters) : vpPanda3DBaseRenderer("set") { m_renderParameters = renderParameters; diff --git a/tutorial/ar/tutorial-panda3d-renderer.cpp b/tutorial/ar/tutorial-panda3d-renderer.cpp index 617938e784..6cdb70564c 100644 --- a/tutorial/ar/tutorial-panda3d-renderer.cpp +++ b/tutorial/ar/tutorial-panda3d-renderer.cpp @@ -160,7 +160,7 @@ int main(int argc, const char **argv) double factor = 1.0; vpPanda3DRenderParameters renderParams(vpCameraParameters(600 * factor, 600 * factor, 320 * factor, 240 * factor), int(480 * factor), int(640 * factor), 0.01, 10.0); unsigned h = renderParams.getImageHeight(), w = renderParams.getImageWidth(); - vpPanda3DRendererSet renderer(renderParams); + vpPanda3DRendererSet renderer; renderer.setRenderParameters(renderParams); renderer.setVerticalSyncEnabled(false); renderer.setAbortOnPandaError(true);