Visual Computing Library
|
Append missing data or Replace existing data to already allocated and partially filled buffers. More...
Functions | |
template<MeshConcept MeshType> | |
void | vcl::appendDuplicateVertexCoordsToBuffer (const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR) |
Append the coordinates of the duplicated vertices to the given buffer. | |
template<FaceMeshConcept MeshType> | |
void | vcl::replaceFaceIndicesByVertexDuplicationToBuffer (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. | |
template<FaceMeshConcept MeshType> | |
void | vcl::replaceTriangulatedFaceIndicesByVertexDuplicationToBuffer (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 duplicated vertices. | |
template<MeshConcept MeshType> | |
void | vcl::appendDuplicateVertexSelectionToBuffer (const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer) |
Append the selection of the duplicated vertices to the given buffer. | |
template<MeshConcept MeshType> | |
void | vcl::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. | |
template<MeshConcept MeshType> | |
void | vcl::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. | |
template<MeshConcept MeshType> | |
void | vcl::appendDuplicateVertexColorsToBuffer (const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer, Color::Format colorFormat) |
Append the color (packed in a single 32 bit value using the provided format) of the duplicated vertices to the given buffer. | |
template<MeshConcept MeshType> | |
void | vcl::appendDuplicateVertexQualityToBuffer (const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer) |
Append the quality of the duplicated vertices to the given buffer. | |
template<MeshConcept MeshType> | |
void | vcl::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. | |
template<MeshConcept MeshType> | |
void | vcl::appendDuplicateVertexTexCoordIndicesToBuffer (const MeshType &mesh, const std::list< uint > &vertsToDuplicate, auto *buffer) |
Append the texture coordinate indices of the duplicated vertices to the given buffer. | |
template<FaceMeshConcept MeshType> | |
void | vcl::wedgeTexCoordsAsDuplicatedVertexTexCoordsToBuffer (const MeshType &mesh, const std::vector< std::pair< vcl::uint, vcl::uint > > &vertWedgeMap, const std::list< std::list< std::pair< vcl::uint, vcl::uint > > > &facesToReassign, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR) |
Export wedge texture coordinates to a buffer of the duplicated vertex texture coordinates. | |
template<FaceMeshConcept MeshType> | |
void | vcl::wedgeTexCoordIndicesAsDuplicatedVertexTexCoordIndicesToBuffer (const MeshType &mesh, const std::vector< std::pair< vcl::uint, vcl::uint > > &vertWedgeMap, const std::list< std::list< std::pair< vcl::uint, vcl::uint > > > &facesToReassign, auto *buffer) |
Export wedge texture coordinate indices to a buffer of the duplicated vertex texture coordinate indices. | |
Append missing data or Replace existing data to already allocated and partially filled buffers.
Buffer Algorithms
These algorithms are useful when you already have allocated and filled buffers with mesh data, and you want to append missing data to them or replace existing data with new data.
An example of missing data are the duplicate vertices that are necessary to render a mesh with wedge texture coordinates. In this scenario, an example of workflow is:
0. Compute all the required data necessary to know the number of duplicated vertices and which vertices are duplicated;
You can access these algorithms by including #include <vclib/algorithms/mesh/import_export.h>
void vcl::appendDuplicateVertexColorsToBuffer | ( | const MeshType & | mesh, |
const std::list< uint > & | vertsToDuplicate, | ||
auto * | buffer, | ||
Color::Format | colorFormat | ||
) |
Append the color (packed in a single 32 bit value using the provided format) of the duplicated vertices to the given buffer.
Given the list of vertices to duplicate, this function appends to the given buffer the color (packed in a single 32 bit value using the provided format) of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexColorToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the colors. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex color. |
void vcl::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.
Given the list of vertices to duplicate, this function appends to the given buffer the colors of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexColorsToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the colors. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex colors. |
[in] | representation | The representation of the color in the buffer. |
[in] | storage | The storage type of the matrix (row or column major). |
void vcl::appendDuplicateVertexCoordsToBuffer | ( | const MeshType & | mesh, |
const std::list< uint > & | vertsToDuplicate, | ||
auto * | buffer, | ||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR |
||
) |
Append the coordinates of the duplicated vertices to the given buffer.
Given the list of vertices to duplicate, this function appends to the given buffer the coordinates of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexCoordsToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the coordinates. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[in/out] | buffer: The buffer where to append the duplicated vertices. | |
[in] | storage | The storage type of the matrix (row or column major). |
void vcl::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.
Given the list of vertices to duplicate, this function appends to the given buffer the normals of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexNormalsToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the normals. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex normals. |
[in] | storage | The storage type of the matrix (row or column major). |
void vcl::appendDuplicateVertexQualityToBuffer | ( | const MeshType & | mesh, |
const std::list< uint > & | vertsToDuplicate, | ||
auto * | buffer | ||
) |
Append the quality of the duplicated vertices to the given buffer.
Given the list of vertices to duplicate, this function appends to the given buffer the quality of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexQualityToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the quality. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex quality. |
void vcl::appendDuplicateVertexSelectionToBuffer | ( | const MeshType & | mesh, |
const std::list< uint > & | vertsToDuplicate, | ||
auto * | buffer | ||
) |
Append the selection of the duplicated vertices to the given buffer.
Given the list of vertices to duplicate, this function appends to the given buffer the selection of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexSelectionToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the selection. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex selection. |
void vcl::appendDuplicateVertexTexCoordIndicesToBuffer | ( | const MeshType & | mesh, |
const std::list< uint > & | vertsToDuplicate, | ||
auto * | buffer | ||
) |
Append the texture coordinate indices of the duplicated vertices to the given buffer.
Given the list of vertices to duplicate, this function appends to the given buffer the vertex texture coordinate indices of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexTexCoordIndicesToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the vertex texture coordinate indices. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex texture coordinate indices. |
void vcl::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.
Given the list of vertices to duplicate, this function appends to the given buffer the vertex texture coordinates of the vertices listed in the input list.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with the vertexTexCoordsToBuffer function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the vertex texture coordinates. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be appended to the buffer. |
[out] | buffer | The buffer where to append the duplicated vertex texture coordinates. |
[in] | storage | The storage type of the matrix (row or column major). |
void vcl::replaceFaceIndicesByVertexDuplicationToBuffer | ( | 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.
Given a buffer containing the vertex indices of the faces of a mesh (stored in row-major order, and with a fixed face size), this function updates the indices of the vertices that have been duplicated, according to the data stored in the input lists.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with any of the functions defined in Export Mesh to Buffer Algorithms that export face indices. e.g.:
MeshType | The type of the mesh. |
[in] | mesh | The input mesh. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be replaced in the buffer. |
[in] | facesToReassign | The list of lists of pairs face/vertex index in the face that must be reassigned to the duplicated vertices. Each list of pairs is the list of faces that must be reassigned to the corresponding duplicated vertex. |
[out] | buffer | The buffer where to replace the vertex indices. |
[in] | largestFaceSize | The size of the largest face in the mesh (that corresponds to the number of columns in the buffer) |
[in] | storage | The storage type of the matrix (row or column major). |
void vcl::replaceTriangulatedFaceIndicesByVertexDuplicationToBuffer | ( | 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 duplicated vertices.
Given a buffer containing the vertex indices of the triangles of a mesh that has been triangulated (stored in row-major order), this function updates the indices of the vertices that have been duplicated, according to the data stored in the input lists.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function and along with triangulatedFaceIndicesToBuffer function that export triangulated face indices. e.g.:
MeshType | The type of the mesh. |
[in] | mesh | The input mesh. |
[in] | vertsToDuplicate | The list of vertices to duplicate: each element is the index of a vertex in the mesh, that must be replaced in the buffer. |
[in] | facesToReassign | The list of lists of pairs face/vertex index in the face that must be reassigned to the duplicated vertices. Each list of pairs is the list of faces that must be reassigned to the corresponding duplicated vertex. |
[in] | indexMap | The map from triangle index to face index. |
[out] | buffer | The buffer where to replace the vertex indices. |
[in] | storage | The storage type of the matrix (row or column major). |
void vcl::wedgeTexCoordIndicesAsDuplicatedVertexTexCoordIndicesToBuffer | ( | const MeshType & | mesh, |
const std::vector< std::pair< vcl::uint, vcl::uint > > & | vertWedgeMap, | ||
const std::list< std::list< std::pair< vcl::uint, vcl::uint > > > & | facesToReassign, | ||
auto * | buffer | ||
) |
Export wedge texture coordinate indices to a buffer of the duplicated vertex texture coordinate indices.
Given the list of vertices to duplicate, this function exports to the given buffer the wedge texture indices as if they were vertex texture indices, and appending only the texture indices of the vertices to duplicate.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the wedge texture coordinate indices. |
[in] | vertWedgeMap | The map from non-duplicated vertex index to face index and wedge index in the face. |
[in] | facesToReassign | The list of lists of pairs face/vertex index in the face that must be reassigned to the duplicated vertices. Each list of pairs is the list of faces that must be reassigned to the corresponding duplicated vertex. |
[out] | buffer | The buffer where to export the vertex wedge texture coordinate indices. |
void vcl::wedgeTexCoordsAsDuplicatedVertexTexCoordsToBuffer | ( | const MeshType & | mesh, |
const std::vector< std::pair< vcl::uint, vcl::uint > > & | vertWedgeMap, | ||
const std::list< std::list< std::pair< vcl::uint, vcl::uint > > > & | facesToReassign, | ||
auto * | buffer, | ||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR |
||
) |
Export wedge texture coordinates to a buffer of the duplicated vertex texture coordinates.
Given the list of vertices to duplicate, this function exports to the given buffer the wedge texture coordinates as if they were vertex texture coordinates, and appending only the texture coordinates of the vertices to duplicate.
Typical usage of this function is after the countVerticesToDuplicateByWedgeTexCoords function:
MeshType | The type of the mesh. |
[in] | mesh | The mesh from which take the wedge texture coordinates. |
[in] | vertWedgeMap | The map from non-duplicated vertex index to face index and wedge index in the face. |
[in] | facesToReassign | The list of lists of pairs face/vertex index in the face that must be reassigned to the duplicated vertices. Each list of pairs is the list of faces that must be reassigned to the corresponding duplicated vertex. |
[out] | buffer | The buffer where to export the vertex wedge texture coordinates. |
[in] | storage | The storage type of the matrix (row or column major). |