class mrpt::viz::CMeshFast
Overview
A planar (XY) grid where each cell has an associated height and, optionally, a texture map.
To make it faster to render, instead of drawing lines and triangles it draws a point at each gridcell. A typical usage example would be an elevation map or a 3D model of a terrain.
See also:
opengl::Scene
#include <mrpt/viz/CMeshFast.h> class CMeshFast: public mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Points { public: // typedefs typedef std::shared_ptr<mrpt::viz ::CMeshFast> Ptr; typedef std::shared_ptr<const mrpt::viz ::CMeshFast> ConstPtr; typedef std::unique_ptr<mrpt::viz ::CMeshFast> UniquePtr; typedef std::unique_ptr<const mrpt::viz ::CMeshFast> ConstUniquePtr; // fields static constexpr const char* className = "mrpt::viz" "::" "CMeshFast"; // construction CMeshFast( bool enableTransparency = false, float xMin_p = -1.0f, float xMax_p = 1.0f, float yMin_p = -1.0f, float yMax_p = 1.0f ); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; void setGridLimits( float xmin, float xmax, float ymin, float ymax ); void getGridLimits( float& xmin, float& xmax, float& ymin, float& ymax ) const; void enableTransparency(bool v); void enableColorFromZ( bool v, mrpt::img::TColormap colorMap = mrpt::img::cmJET ); void setZ(const mrpt::math::CMatrixDynamic<float>& in_Z); void getZ(mrpt::math::CMatrixFloat& out) const; float getXMin() const; float getXMax() const; float getYMin() const; float getYMax() const; void setXMin(float nxm); void setXMax(float nxm); void setYMin(float nym); void setYMax(float nym); void getXBounds( float& min, float& max ) const; void getYBounds( float& min, float& max ) const; void setXBounds( float min, float max ); void setYBounds( float min, float max ); virtual void updateBuffers() const; virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const; void assignImage(const mrpt::img::CImage& img); void assignImageAndZ(const mrpt::img::CImage& img, const mrpt::math::CMatrixDynamic<float>& in_Z); void adjustGridToImageAR(); void setPointSize(float p); void enableVariablePointSize(bool enable = true); void setVariablePointSize_k(float v); void setVariablePointSize_DepthScale(float v); };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; // structs struct PoseAndScale; struct State; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; const auto& shaderPointsVertexPointBuffer() const; const auto& shaderPointsVertexColorBuffer() const; auto& shaderPointsBuffersMutex() const; float getPointSize() const; bool isEnabledVariablePointSize() const; float getVariablePointSize_k() const; float getVariablePointSize_DepthScale() const;
Typedefs
typedef std::shared_ptr<mrpt::viz ::CMeshFast> Ptr
A type for the associated smart pointer.
Construction
CMeshFast( bool enableTransparency = false, float xMin_p = -1.0f, float xMax_p = 1.0f, float yMin_p = -1.0f, float yMax_p = 1.0f )
Constructor.
Methods
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
void setZ(const mrpt::math::CMatrixDynamic<float>& in_Z)
This method sets the matrix of heights for each position (cell) in the mesh grid.
void getZ(mrpt::math::CMatrixFloat& out) const
Returns a reference to the internal Z matrix, allowing changing it efficiently.
virtual void updateBuffers() const
Called by the rendering system to update internal geometry buffers.
Derived classes should override this to populate their data buffers (triangles, points, lines) when the object geometry changes.
This is called automatically when hasToUpdateBuffers() returns true, which happens after notifyChange() was called.
The base implementation does nothing; derived classes should override.
Thread safety: implementations should lock the appropriate mutexes when writing to shared buffers.
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const
Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates.
This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.
See also:
getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()
void assignImage(const mrpt::img::CImage& img)
Assigns a texture image, and disable transparency.
void assignImageAndZ(const mrpt::img::CImage& img, const mrpt::math::CMatrixDynamic<float>& in_Z)
Assigns a texture image and Z simultaneously, and disable transparency.
void adjustGridToImageAR()
Adjust grid limits according to the image aspect ratio, maintaining the X limits and resizing in the Y direction.
void setPointSize(float p)
By default is 1.0.
See also:
void enableVariablePointSize(bool enable = true)
Enable/disable variable eye distance-dependent point size (default=true)
void setVariablePointSize_k(float v)
see CRenderizableShaderPoints for a discussion of this parameter.
void setVariablePointSize_DepthScale(float v)
see CRenderizableShaderPoints for a discussion of this parameter.