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