31 #include <visp3/rbt/vpObjectCentricRenderer.h>
33 #include <visp3/core/vpRect.h>
35 #include "boundingSphere.h"
36 #include "boundingBox.h"
37 #include "load_prc_file.h"
45 load_prc_file_data(
"",
"textures-power-2 none\n"
51 "load-file-type p3assimp\n"
52 "audio-library-name null\n"
58 if (m_shouldComputeBBPoints) {
60 m_shouldComputeBBPoints =
false;
73 unsigned width = (unsigned)(m_bb.
getWidth());
74 unsigned height = (unsigned)(m_bb.
getHeight());
80 for (std::shared_ptr<vpPanda3DBaseRenderer> &subrenderer :
m_subRenderers) {
81 subrenderer->setRenderParameters(subParams);
91 std::shared_ptr<vpPanda3DBaseRenderer> subrenderer =
m_subRenderers[0];
92 NodePath
object = subrenderer->getRenderRoot().find(m_focusedObject);
93 if (
object.is_empty()) {
98 object.calc_tight_bounds(minP, maxP);
99 const BoundingBox box(minP, maxP);
101 for (
unsigned int i = 0; i < 8; ++i) {
102 const LPoint3 p = box.get_point(i);
103 m_bb3DPoints.push_back(
vpColVector({ p.get_x(), -p.get_z(), p.get_y(), 1.0 }));
112 std::shared_ptr<vpPanda3DBaseRenderer> subrenderer =
m_subRenderers[0];
113 NodePath
object = subrenderer->getRenderRoot().find(m_focusedObject);
114 if (
object.is_empty()) {
117 if (m_shouldComputeBBPoints) {
119 m_shouldComputeBBPoints =
false;
124 float minZ = std::numeric_limits<float>::max(), maxZ = 0.f;
125 for (
unsigned int i = 0; i < m_bb3DPoints.size(); ++i) {
146 std::shared_ptr<vpPanda3DBaseRenderer> subrenderer =
m_subRenderers[0];
147 NodePath
object = subrenderer->getRenderRoot().find(m_focusedObject);
148 if (
object.is_empty()) {
151 if (m_shouldComputeBBPoints) {
153 m_shouldComputeBBPoints =
false;
158 double x = cpV[0] / cpV[2];
159 double y = cpV[1] / cpV[2];
172 for (
unsigned int i = 0; i < m_bb3DPoints.size(); ++i) {
173 const vpImagePoint ip = pointToPixel(camTobj, m_bb3DPoints[i]);
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static T clamp(const T &v, const T &lower, const T &upper)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
void computeClipping(float &nearV, float &farV)
vpObjectCentricRenderer(const vpPanda3DRenderParameters &renderParameters)
void computeBoundingBox3DPoints()
vpRect computeBoundingBox()
void beforeFrameRendered() VP_OVERRIDE
static const vpHomogeneousMatrix PANDA_T_VISP
Homogeneous transformation matrix to convert from the Panda coordinate system (right-handed Z-up) to ...
vpPanda3DRenderParameters m_renderParameters
Pointer to owning window, which can create buffers etc. It is not necessarily visible.
Rendering parameters for a panda3D simulation.
unsigned int getImageWidth() const
void setCameraIntrinsics(const vpCameraParameters &cam)
set camera intrinsics. Only camera intrinsics for a lens without distortion are supported.
unsigned int getImageHeight() const
const vpCameraParameters & getCameraIntrinsics() const
Retrieve camera intrinsics.
void setImageResolution(unsigned int height, unsigned int width)
Set the image resolution. When this object is given to a vpPanda3DBaseRenderer, this will be the reso...
Class that renders multiple datatypes, in a single pass. A renderer set contains multiple subrenderer...
std::vector< std::shared_ptr< vpPanda3DBaseRenderer > > m_subRenderers
vpHomogeneousMatrix getCameraPose() VP_OVERRIDE
Retrieve the pose of the camera. As this renderer contains multiple other renderers.
vpHomogeneousMatrix getNodePose(const std::string &name) VP_OVERRIDE
Retrieve the pose of a scene node. The pose is in the world frame, using a ViSP convention.
Defines a rectangle in the plane.
void setRight(double pos)
void setBottom(double pos)