44 size_t vind[3] = {0, 0, 0};
50 void render(
const RenderContext& rc)
const override;
70 float yMin = -1.0f,
float yMax = 1.0f);
77 m_xMin =
static_cast<float>(xMin);
78 m_xMax =
static_cast<float>(xMax);
79 m_yMin =
static_cast<float>(yMin);
80 m_yMax =
static_cast<float>(yMax);
84 void getGridLimits(
float& xMin,
float& xMax,
float& yMin,
float& yMax)
const 241 std::pair<mrpt::opengl::TTriangle, TTriangleVertexIndices>>
251 mutable std::vector<mrpt::math::TPolygonWithPlane>
tmpPolys;
virtual ~CMesh() override
CMesh(bool enableTransparency=false, float xMin=-1.0f, float xMax=1.0f, float yMin=-1.0f, float yMax=1.0f)
math::CMatrixF C
Grayscale Color [0,1] for each cell, updated by updateColorsMatrix.
TColormap
Different colormaps for use in mrpt::img::colormap()
std::vector< mrpt::math::TPolygonWithPlane > tmpPolys
void assignImageAndZ(const mrpt::img::CImage &img, const mrpt::math::CMatrixDynamic< float > &in_Z)
Assigns a texture image and Z simultaneously, and disable transparency.
static constexpr shader_id_t TEXTURED_TRIANGLES
bool m_trianglesUpToDate
Whether the actual mesh needs to be recalculated.
virtual shader_list_t requiredShaders() const override
Returns the ID of the OpenGL shader program required to render this class.
bool m_polygonsUpToDate
Whether the polygon mesh (auxiliary structure for ray tracing) needs to be recalculated.
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
void enableTransparency(bool v)
bool m_enableTransparency
void enableWireFrame(bool v)
void freeOpenGLResources() override
Free opengl buffers.
math::CMatrixF C_b
Blue Component of the Color [0,1] for each cell, updated by updateColorsMatrix.
void getXBounds(float &min, float &max) const
bool m_modified_Z
Whether C is not up-to-date wrt to Z.
void setMask(const mrpt::math::CMatrixDynamic< float > &in_mask)
This method sets the boolean mask of valid heights for each position (cell) in the mesh grid...
mrpt::img::TColormap m_colorMap
Used when m_colorFromZ is true.
std::vector< shader_id_t > shader_list_t
A list of shader IDs.
void assignImage(const mrpt::img::CImage &img)
Assigns a texture image.
void getGridLimits(float &xMin, float &xMax, float &yMin, float &yMax) const
void setyMax(const float nym)
void freeOpenGLResources() override
Free opengl buffers.
static constexpr shader_id_t WIREFRAME
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Trace ray.
void setYBounds(const float min, const float max)
math::CMatrixF C_g
Green Component of the Color [0,1] for each cell, updated by updateColorsMatrix.
void enableColorFromZ(bool v, mrpt::img::TColormap colorMap=mrpt::img::cmHOT)
void setxMax(const float nxm)
void updatePolygons() const
math::CMatrixF C_r
Red Component of the Color [0,1] for each cell, updated by updateColorsMatrix.
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
void setZ(const mrpt::math::CMatrixDynamic< float > &in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid. ...
This class is a "CSerializable" wrapper for "CMatrixFloat".
void setxMin(const float nxm)
void getZ(mrpt::math::CMatrixFloat &out) const
Returns a reference to the internal Z matrix, allowing changing it efficiently.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void onUpdateBuffers_Wireframe() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
void setGridLimits(T xMin, T xMax, T yMin, T yMax)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
std::vector< std::pair< mrpt::opengl::TTriangle, TTriangleVertexIndices > > actualMesh
List of triangles in the mesh.
void setyMin(const float nym)
Renderizable generic renderer for objects using the wireframe shader.
The namespace for 3D scene representation and rendering.
void updateColorsMatrix() const
Called internally to assure C is updated.
void getYBounds(float &min, float &max) const
void adjustGridToImageAR()
Adjust grid limits according to the image aspect ratio, maintaining the X limits and resizing in the ...
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void setXBounds(const float min, const float max)
void onUpdateBuffers_TexturedTriangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
A planar (XY) grid where each cell has an associated height and, optionally, a texture map...
void freeOpenGLResources() override
Free opengl buffers.
This template class provides the basic functionality for a general 2D any-size, resizable container o...
Renderizable generic renderer for objects using the triangles-with-a-texture shader.
math::CMatrixF Z
Z(x,y): Z-coordinate of the point (x,y)
void updateTriangles() const
Called internally to assure the triangle list is updated.
std::vector< std::pair< mrpt::math::TPoint3D, size_t > > vertex_normals
The accumulated normals & counts for each vertex, so normals can be averaged.
bool m_modified_Image
Whether C is not up-to-date wrt to the texture image.
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.
void getMask(mrpt::math::CMatrixFloat &out) const
Returns a reference to the internal mask matrix, allowing changing it efficiently.
A class for storing images as grayscale or RGB bitmaps.