Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpPanda3DRendererSet.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 */
30
31#ifndef VP_PANDA3D_RENDERER_SET_H
32#define VP_PANDA3D_RENDERER_SET_H
33
34#include <visp3/core/vpConfig.h>
35
36#if defined(VISP_HAVE_PANDA3D)
37
38#include <vector>
39
40#include <visp3/ar/vpPanda3DBaseRenderer.h>
41#include <visp3/ar/vpPanda3DLight.h>
42
75{
76public:
78 vpPanda3DRendererSet(const vpPanda3DRenderParameters &renderParameters);
79
80 virtual ~vpPanda3DRendererSet() = default;
81
88 void initFramework() VP_OVERRIDE;
89 void initFromParent(PointerTo<WindowFramework> window) VP_OVERRIDE;
90 void initFromParent(const vpPanda3DBaseRenderer &renderer) VP_OVERRIDE;
91
92
93 void clearScene() VP_OVERRIDE
94 {
95 for (std::shared_ptr<vpPanda3DBaseRenderer> renderer: m_subRenderers) {
96 renderer->clearScene();
97 }
98 }
99
105 void setCameraPose(const vpHomogeneousMatrix &wTc) VP_OVERRIDE;
106
116
126 void setNodePose(const std::string &name, const vpHomogeneousMatrix &wTo) VP_OVERRIDE;
127
135 void setNodePose(NodePath &object, const vpHomogeneousMatrix &wTo) VP_OVERRIDE;
136
147 vpHomogeneousMatrix getNodePose(const std::string &name) VP_OVERRIDE;
148
155 vpHomogeneousMatrix getNodePose(NodePath &object) VP_OVERRIDE;
156
160 void addNodeToScene(const NodePath &object) VP_OVERRIDE;
161
162 virtual void setRenderParameters(const vpPanda3DRenderParameters &params) VP_OVERRIDE;
163
164 void addLight(const vpPanda3DLight &light) VP_OVERRIDE;
165
173 void addSubRenderer(std::shared_ptr<vpPanda3DBaseRenderer> renderer);
174
175 void enableSharedDepthBuffer(vpPanda3DBaseRenderer &sourceBuffer) VP_OVERRIDE;
176
183 template<typename RendererType>
184 std::shared_ptr<RendererType> getRenderer()
185 {
186 for (std::shared_ptr<vpPanda3DBaseRenderer> &renderer: m_subRenderers) {
187 std::shared_ptr<RendererType> rendererCast = std::dynamic_pointer_cast<RendererType>(renderer);
188 if (rendererCast != nullptr) {
189 return rendererCast;
190 }
191 }
192 return nullptr;
193 }
194
202 template<typename RendererType>
203 std::shared_ptr<RendererType> getRenderer(const std::string &name)
204 {
205 for (std::shared_ptr<vpPanda3DBaseRenderer> &renderer: m_subRenderers) {
206 if (renderer->getName() == name) {
207 std::shared_ptr<RendererType> rendererCast = std::dynamic_pointer_cast<RendererType>(renderer);
208 if (rendererCast != nullptr) {
209 return rendererCast;
210 }
211 }
212 }
213 return nullptr;
214 }
215
216 virtual void beforeFrameRendered() VP_OVERRIDE
217 {
218 for (std::shared_ptr<vpPanda3DBaseRenderer> &renderer: m_subRenderers) {
219 renderer->beforeFrameRendered();
220 }
221 }
222
223 virtual void afterFrameRendered() VP_OVERRIDE
224 {
225 for (std::shared_ptr<vpPanda3DBaseRenderer> &renderer: m_subRenderers) {
226 renderer->afterFrameRendered();
227 }
228 }
229
230protected:
231 void setupScene() VP_OVERRIDE { }
232
233 void setupCamera() VP_OVERRIDE { }
234
235 std::vector<std::shared_ptr<vpPanda3DBaseRenderer>> m_subRenderers;
236};
237END_VISP_NAMESPACE
238#endif
239#endif
Implementation of an homogeneous matrix and operations on such kind of matrices.
Base class for a panda3D renderer. This class handles basic functionalities, such as loading object,...
vpPanda3DBaseRenderer(const std::string &rendererName)
virtual vpHomogeneousMatrix getCameraPose()
Retrieve the camera's pose, in the world frame. The pose is specified using the ViSP convention (Y-do...
virtual void initFramework()
Initialize the whole Panda3D framework. Create a new PandaFramework object and a new window.
virtual void setCameraPose(const vpHomogeneousMatrix &wTc)
Set the camera's pose. The pose is specified using the ViSP convention (Y-down right handed).
Base class for a Light that can be added to a Panda3D scene.
Interface for objects, scenes or other Panda3D related data that can be lit by a vpPanda3DLight.
Rendering parameters for a panda3D simulation.
void initFromParent(PointerTo< WindowFramework > window) VP_OVERRIDE
virtual ~vpPanda3DRendererSet()=default
std::shared_ptr< RendererType > getRenderer(const std::string &name)
Retrieve the subrenderer with the specified template type and the given name.
std::vector< std::shared_ptr< vpPanda3DBaseRenderer > > m_subRenderers
void setupScene() VP_OVERRIDE
Initialize the scene for this specific renderer.
void clearScene() VP_OVERRIDE
std::shared_ptr< RendererType > getRenderer()
Retrieve the first subrenderer with the specified template type.
virtual void afterFrameRendered() VP_OVERRIDE
virtual void beforeFrameRendered() VP_OVERRIDE
void setupCamera() VP_OVERRIDE
Initialize camera. Should be called when the scene root of this render has already been created.