45 bool interpolateColorIfNoTexture)
override;
47 unsigned char vertIndex,
49 bool returnColorIfNoTexture)
override;
64 int& i3)
const override;
69 int& i3)
const override;
85 inline unsigned size()
const override {
86 return static_cast<unsigned>(m_triIndexes.size());
88 void forEach(genericTriangleAction action)
override;
93 unsigned index)
override;
96 unsigned triangleIndex)
override;
104 double C[3])
const override;
117 return m_triIndexes[localIndex];
122 assert(m_globalIterator <
size());
123 return m_triIndexes[m_globalIterator];
130 void clear(
bool releaseMemory);
136 bool addTriangleIndex(
unsigned globalIndex);
143 bool addTriangleIndex(
unsigned firstIndex,
unsigned lastIndex);
149 void setTriangleIndex(
unsigned localIndex,
unsigned globalIndex);
154 bool reserve(
size_t n);
159 bool resize(
size_t n);
172 void setAssociatedMesh(
ccMesh* mesh,
bool unlinkPreviousOne =
true);
185 ccSubMesh* createNewSubMeshFromSelection(
186 bool removeSelectedTriangles,
187 const std::vector<int>& selectedTriangleIndexes,
188 IndexMap* newRemainingTriangleIndexes =
nullptr);
203 ccSubMesh* createNewSubMeshFromSelection(
bool removeSelectedFaces,
208 bool toFile_MeOnly(QFile& out,
short dataVersion)
const override;
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Array of compressed 3D normals (single index)
Array of 2D texture coordinates.
virtual bool hasDisplayedScalarField() const
Returns whether an active scalar field is available or not.
virtual bool hasColors() const
Returns whether colors are enabled or not.
virtual bool normalsShown() const
Returns whether normals are shown or not.
virtual bool hasNormals() const
Returns whether normals are enabled or not.
virtual bool hasScalarFields() const
Returns whether one or more scalar fields are instantiated.
virtual TextureCoordsContainer * getTexCoordinatesTable() const =0
Returns per-triangle texture coordinates array.
virtual bool hasTextures() const =0
Returns whether textures are available for this mesh.
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
virtual void getTriangleNormalIndexes(unsigned triangleIndex, int &i1, int &i2, int &i3) const =0
Returns a triplet of normal indexes for a given triangle (if any)
virtual bool hasPerTriangleTexCoordIndexes() const =0
Returns whether this mesh as per-triangle triplets of tex coords indexes.
virtual void getTriangleTexCoordinatesIndexes(unsigned triangleIndex, int &i1, int &i2, int &i3) const =0
Returns the triplet of tex coords indexes for a given triangle.
virtual const ccMaterialSet * getMaterialSet() const =0
virtual bool hasTriNormals() const =0
Returns whether the mesh has per-triangle normals.
virtual bool getTriangleNormals(unsigned triangleIndex, CCVector3 &Na, CCVector3 &Nb, CCVector3 &Nc) const =0
Returns a given triangle normal.
virtual bool interpolateNormalsBC(unsigned triIndex, const CCVector3d &w, CCVector3 &N)=0
Interpolates normal(s) inside a given triangle.
virtual int getTriangleMtlIndex(unsigned triangleIndex) const =0
Returns a given triangle material indexes.
short minimumFileVersion_MeOnly() const override
virtual ccGenericPointCloud * getAssociatedCloud() const =0
Returns the vertices cloud.
virtual bool interpolateColors(unsigned triIndex, const CCVector3 &P, ecvColor::Rgb &C)=0
Interpolates RGB colors inside a given triangle.
virtual bool getVertexColorFromMaterial(unsigned triIndex, unsigned char vertIndex, ecvColor::Rgb &C, bool returnColorIfNoTexture)=0
virtual void getTriangleTexCoordinates(unsigned triIndex, TexCoords2D *&tx1, TexCoords2D *&tx2, TexCoords2D *&tx3) const =0
Returns per-triangle texture coordinates (pointer to)
virtual NormsIndexesTableType * getTriNormsTable() const =0
Returns per-triangle normals shared array.
virtual void getTexCoordinates(unsigned index, TexCoords2D *&tx) const =0
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
virtual unsigned capacity() const =0
Returns max capacity.
virtual void refreshBB()=0
Forces bounding-box update.
virtual bool getColorFromMaterial(unsigned triIndex, const CCVector3 &P, ecvColor::Rgb &C, bool interpolateColorIfNoTexture)=0
virtual bool hasMaterials() const =0
A 3D cloud interface with associated features (color, normals, octree, etc.)
Hierarchical CLOUDVIEWER Object.
virtual void onUpdateOf(ccHObject *obj)
This method is called when another object (geometry) is updated.
virtual ccBBox getOwnBB(bool withGLFeatures=false)
Returns the entity's own bounding-box.
Mesh (triangle) material.
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
CV_CLASS_ENUM getClassID() const override
Returns class ID.
std::vector< unsigned int > IndexMap
Indexes map for createNewSubMeshFromSelection.
ccBBox m_bBox
Bounding-box.
const ccMesh * getAssociatedMesh() const
Returns the associated mesh (const version)
bool isSerializable() const override
Returns whether object is serializable of not.
unsigned getTriGlobalIndex(unsigned localIndex) const
unsigned size() const override
Returns the number of triangles.
void placeIteratorAtBeginning() override
Places the mesh iterator at the beginning.
ReferencesContainer m_triIndexes
Indexes of (some of) the associated mesh triangles.
ccMesh * m_associatedMesh
Associated mesh.
void forwardIterator()
Forwards the local element iterator.
std::vector< unsigned int > ReferencesContainer
Container of 3D triangles indexes.
unsigned getCurrentTriGlobalIndex() const
Returns the global index of the triangle pointed by the current element.
unsigned m_globalIterator
Iterator on the triangles references container.
ccMesh * getAssociatedMesh()
Returns the associated mesh.
~ccSubMesh() override=default
Destructor.
virtual bool interpolateNormals(unsigned triIndex, const CCVector3 &P, CCVector3 &N)
Interpolates normal(s) inside a given triangle.
virtual GenericTriangle * _getTriangle(unsigned triangleIndex)=0
Returns the ith triangle.
virtual VerticesIndexes * getNextTriangleVertIndexes()=0
virtual VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex)=0
Returns the indexes of the vertices of a given triangle.
virtual void getTriangleVertices(unsigned triangleIndex, CCVector3 &A, CCVector3 &B, CCVector3 &C) const =0
Returns the vertices of a given triangle.
virtual unsigned size() const =0
Returns the number of triangles.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the mesh bounding-box.
virtual GenericTriangle * _getNextTriangle()=0
Returns the next triangle (relatively to the global iterator position)
virtual void forEach(genericTriangleAction action)=0
Fast iteration mechanism.
A generic triangle interface.
Triangle described by the indexes of its 3 vertices.