class mrpt::viz::CMesh3D
Overview
A 3D mesh composed of triangles and/or quads.
A typical usage example would be a 3D model of an object.
See also:
opengl::Scene, opengl::CMesh, opengl::CAssimpModel
#include <mrpt/viz/CMesh3D.h> class CMesh3D: public mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Lines, public mrpt::viz::VisualObjectParams_Triangles { public: // construction CMesh3D(); // methods void enableShowEdges(bool v); void enableShowFaces(bool v); void enableShowVertices(bool v); void enableFaceNormals(bool v); void loadMesh( unsigned int num_verts, unsigned int num_faces, int* verts_per_face, int* face_verts, float* vert_coords ); void loadMesh( unsigned int num_verts, unsigned int num_faces, const mrpt::math::CMatrixDynamic<bool>& is_quad, const mrpt::math::CMatrixDynamic<int>& face_verts, const mrpt::math::CMatrixDynamic<float>& vert_coords ); void setEdgeColor( float r, float g, float b, float a = 1.f ); void setFaceColor( float r, float g, float b, float a = 1.f ); void setVertColor( float r, float g, float b, float a = 1.f ); virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::unique_ptr<CObject> UniquePtr; typedef std::unique_ptr<const CObject> ConstUniquePtr; // structs struct OutdatedState; struct State; // methods void setLineWidth(float w); float getLineWidth() const; void enableAntiAliasing(bool enable = true); bool isAntiAliasingEnabled() const; const auto& shaderTrianglesBuffer() const; auto& shaderTrianglesBufferMutex() const; virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c); bool isLightEnabled() const; void enableLight(bool enable = true); TCullFace cullFaces() const; void notifyBBoxChange() const; auto getBoundingBoxLocalf() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
Methods
void loadMesh( unsigned int num_verts, unsigned int num_faces, int* verts_per_face, int* face_verts, float* vert_coords )
Load a 3D mesh.
The arguments indicate:
num_verts: Number of vertices of the mesh
num_faces: Number of faces of the mesh
verts_per_face: An array (pointer) with the number of vertices of each face. The elements must be set either to 3 (triangle) or 4 (quad).
face_verts: An array (pointer) with the vertices of each face. The vertices of each face must be consecutive in this array.
vert_coords: An array (pointer) with the coordinates of each vertex. The xyz coordinates of each vertex must be consecutive in this array.
void loadMesh( unsigned int num_verts, unsigned int num_faces, const mrpt::math::CMatrixDynamic<bool>& is_quad, const mrpt::math::CMatrixDynamic<int>& face_verts, const mrpt::math::CMatrixDynamic<float>& vert_coords )
Load a 3D mesh.
The arguments indicate:
num_verts: Number of vertices of the mesh
num_faces: Number of faces of the mesh
is_quad: A binary array saying whether the face is a quad (1) or a triangle (0)
face_verts: An array with the vertices of each face. For every column (face), each row contains the num of a vertex. The fourth does not need to be filled if the face is a triangle.
vert_coords: An array with the coordinates of each vertex. For every column (vertex), each row contains the xyz coordinates of the vertex.
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()