23#ifndef VCL_ALGORITHMS_MESH_IMPORT_EXPORT_APPEND_REPLACE_TO_BUFFER_H
24#define VCL_ALGORITHMS_MESH_IMPORT_EXPORT_APPEND_REPLACE_TO_BUFFER_H
28#include <vclib/mesh.h>
29#include <vclib/space/complex.h>
101template<MeshConcept MeshType>
103 const MeshType& mesh,
108 using namespace detail;
117 const auto&
pos = mesh.vertex(v).position();
172template<FaceMeshConcept MeshType>
174 const MeshType& mesh,
181 using namespace detail;
189 const uint
ROW_NUM = mesh.faceNumber();
191 uint
vFirst = mesh.vertexNumber();
194 for (
const auto& f : faces) {
249template<FaceMeshConcept MeshType>
251 const MeshType& mesh,
258 using namespace detail;
266 uint
vFirst = mesh.vertexNumber();
277 for (uint
vi =
vFirst;
const auto& [vert, faces] :
283 for (
const auto& f : faces) {
288 for (uint
j = 0;
j < 3; ++
j) {
337template<MeshConcept MeshType>
339 const MeshType& mesh,
348 buffer[
i] = mesh.vertex(v).selected();
390template<MeshConcept MeshType>
392 const MeshType& mesh,
397 using namespace detail;
403 requirePerVertexNormal(mesh);
408 const auto& normal = mesh.vertex(v).normal();
455template<MeshConcept MeshType>
457 const MeshType& mesh,
463 using namespace detail;
469 requirePerVertexColor(mesh);
475 const auto& c = mesh.vertex(v).color();
524template<MeshConcept MeshType>
526 const MeshType& mesh,
535 requirePerVertexColor(mesh);
538 const auto& c = mesh.vertex(v).color();
541 case ABGR: buffer[
i] = c.abgr();
break;
542 case ARGB: buffer[
i] = c.argb();
break;
543 case RGBA: buffer[
i] = c.rgba();
break;
544 case BGRA: buffer[
i] = c.bgra();
break;
586template<MeshConcept MeshType>
588 const MeshType& mesh,
596 requirePerVertexQuality(mesh);
599 buffer[
i] = mesh.vertex(v).quality();
645template<MeshConcept MeshType>
647 const MeshType& mesh,
652 using namespace detail;
658 requirePerVertexTexCoord(mesh);
663 const auto& t = mesh.vertex(v).texCoord();
718template<MeshConcept MeshType>
720 const MeshType& mesh,
726 using namespace detail;
732 requirePerVertexTangent(mesh);
738 const auto& t = mesh.vertex(v).tangent();
745 mesh.vertex(v).tangentRightHanded() ? 1.0 : -1.0;
791template<MeshConcept MeshType>
793 const MeshType& mesh,
801 requirePerVertexMaterialIndex(mesh);
804 buffer[
i] = mesh.vertex(v).materialIndex();
A class representing a box in N-dimensional space.
Definition box.h:46
PointT size() const
Computes the size of the box.
Definition box.h:267
Format
Color format enumeration.
Definition color.h:77
Representation
Color representation enumeration.
Definition color.h:64
The TriPolyIndexBiMap class allows to store a bidirectional mapping between a Polygon Mesh and a Tria...
Definition tri_poly_index_bimap.h:50
uint triangleBegin(uint polygonIndex) const
Returns the smallest index of set of triangles mapped to the polygon having the index given as input ...
Definition tri_poly_index_bimap.h:84
uint triangleNumber(uint polygonIndex) const
Returns the number of (consecutive index) triangles mapped to a polygon.
Definition tri_poly_index_bimap.h:113
void replaceTriangulatedFaceVertexIndicesByVertexDuplicationToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, const std::list< std::list< std::pair< uint, uint > > > &facesToReassign, const TriPolyIndexBiMap &indexMap, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Replace the triangulated face vertex indices in the given buffer with the new indices of the duplicat...
Definition append_replace_to_buffer.h:250
void appendDuplicateVertexPositionsToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Append the positions of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:102
void appendDuplicateVertexQualityToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer)
Append the quality of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:587
void appendDuplicateVertexColorsToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, Color::Representation representation=Color::Representation::INT_0_255, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Append the colors of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:456
void appendDuplicateVertexMaterialIndicesToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer)
Append the material indices of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:792
void replaceFaceVertexIndicesByVertexDuplicationToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, const std::list< std::list< std::pair< uint, uint > > > &facesToReassign, auto *buffer, uint largestFaceSize=3, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Replace the face vertex indices in the given buffer with the new indices of the duplicated vertices.
Definition append_replace_to_buffer.h:173
void appendDuplicateVertexSelectionToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer)
Append the selection of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:338
void appendDuplicateVertexTangentsToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, bool storeHandednessAsW=true, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Append the tangent of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:719
void appendDuplicateVertexNormalsToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Append the normals of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:391
void appendDuplicateVertexTexCoordsToBuffer(const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR)
Append the texture coordinates of the duplicated vertices to the given buffer.
Definition append_replace_to_buffer.h:646
MatrixStorageType
A simple type that enumerates the main storage types for matrices (row or column major).
Definition base.h:88
uint largestFaceSize(const FaceMeshConcept auto &mesh)
Returns the largest face size in the mesh.
Definition topology.h:212