Visual Computing Library
|
List Export Mesh to Buffer algorithms. More...
Functions | |
template<MeshConcept MeshType> | |
void | vcl::vertexCoordsToBuffer (const MeshType &mesh, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL) |
Export the vertex coordinates of a mesh to a buffer. | |
template<FaceMeshConcept MeshType> | |
uint | vcl::faceSizesToBuffer (const MeshType &mesh, auto *buffer) |
Export into a buffer the sizes of the faces of a Mesh, and return the sum of the sizes. | |
template<FaceMeshConcept MeshType> | |
void | vcl::faceIndicesToBuffer (const MeshType &mesh, auto *buffer, bool getIndicesAsIfContainerCompact=true) |
Export into a buffer the vertex indices for each face of a Mesh. Faces can be polygons. | |
template<FaceMeshConcept MeshType> | |
void | vcl::faceIndicesToBuffer (const MeshType &mesh, auto *buffer, uint largestFaceSize, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, bool getIndicesAsIfContainerCompact=true, uint rowNumber=UINT_NULL) |
Export into a buffer the vertex indices for each face of a Mesh. Faces can be polygons, and the number of output columns can be set by the user with the largestFaceSize parameter. | |
template<FaceMeshConcept MeshType> | |
void | vcl::triangulatedFaceIndicesToBuffer (const MeshType &mesh, auto *buffer, TriPolyIndexBiMap &indexMap=detail::indexMap, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint numTriangles=UINT_NULL, bool getIndicesAsIfContainerCompact=true) |
Export into a buffer the vertex indices for each triangle computed by triangulating the faces of a Mesh. | |
template<EdgeMeshConcept MeshType> | |
void | vcl::edgeIndicesToBuffer (const MeshType &mesh, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, bool getIndicesAsIfContainerCompact=true, uint rowNumber=UINT_NULL) |
Export into a buffer the vertex indices for each edge of a Mesh. | |
template<FaceMeshConcept MeshType> | |
void | vcl::wireframeIndicesToBuffer (const MeshType &mesh, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, bool getIndicesAsIfContainerCompact=true, uint rowNumber=UINT_NULL) |
Export into a buffer the vertex indices for each edge that composes the wireframe of the Mesh (i.e., the edges of the faces). | |
template<FaceMeshConcept MeshType> | |
void | vcl::faceWedgeTexCoordsToBuffer (const MeshType &mesh, auto *buffer, uint largestFaceSize=3, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL) |
Export the selection status of the elements identified by ELEM_ID of a mesh to a buffer. | |
template<FaceMeshConcept MeshType> | |
void | vcl::faceWedgeTexCoordIndicesToBuffer (const MeshType &mesh, auto *buffer) |
Export into a buffer the per face wedge texture indices of a mesh. | |
template<FaceMeshConcept MeshType> | |
void | vcl::triangulatedFaceWedgeTexCoordIndicesToBuffer (const MeshType &mesh, auto *buffer, const TriPolyIndexBiMap &indexMap) |
Export into a buffer the per triangle wedge texture indices of a mesh. Triangles are computed by triangulating the faces of the mesh. | |
List Export Mesh to Buffer algorithms.
They allow to export mesh data to pre-allocated buffers.
You can access these algorithms by including #include <vclib/algorithms/mesh/import_export.h>
void vcl::edgeIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR , |
||
bool | getIndicesAsIfContainerCompact = true , |
||
uint | rowNumber = UINT_NULL |
||
) |
Export into a buffer the vertex indices for each edge of a Mesh.
This function exports the vertex indices of the edges of a mesh to a buffer. Indices are stored following the order the edges appear in the mesh. The buffer must be preallocated with the correct size (number of edges times 2).
getIndicesAsIfContainerCompact == true
) the function stores the vertex indices as if the vertex container of the mesh is compact. This means that, if the mesh has deleted vertices, the vertex indices stored in the buffer may not correspond to the vertex indices of the mesh. If you want to store the actual vertex indices in the input mesh, set getIndicesAsIfContainerCompact
to false.[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | storage | storage type of the matrix (row or column major) |
[in] | getIndicesAsIfContainerCompact | if true, the function will store the vertex indices as if the vertex container of the mesh is compact. If false, the actual vertex indices in the input mesh will be stored. |
[in] | rowNumber | number of rows of the matrix (if different from the number of edges in the mesh) - used only when storage is column major |
void vcl::faceIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
bool | getIndicesAsIfContainerCompact = true |
||
) |
Export into a buffer the vertex indices for each face of a Mesh. Faces can be polygons.
This function exports the vertex indices of the polygonal faces of a mesh to a buffer. Indices are stored consecutively in the buffer, following the order the faces appear in the mesh. The buffer must be preallocated with the correct size (sum of the sizes of the faces).
You can use the function vcl::faceSizesToBuffer to get the sizes of the faces and allocate the buffer accordingly:
getIndicesAsIfContainerCompact == true
) the function stores the vertex indices as if the vertex container of the mesh is compact. This means that, if the mesh has deleted vertices, the vertex indices stored in the buffer may not correspond to the vertex indices of the mesh. If you want to store the actual vertex indices in the input mesh, set getIndicesAsIfContainerCompact
to false.[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | getIndicesAsIfContainerCompact | if true, the function will store the vertex indices as if the vertex container of the mesh is compact. If false, the actual vertex indices in the input mesh will be stored. |
void vcl::faceIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
uint | largestFaceSize, | ||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR , |
||
bool | getIndicesAsIfContainerCompact = true , |
||
uint | rowNumber = UINT_NULL |
||
) |
Export into a buffer the vertex indices for each face of a Mesh. Faces can be polygons, and the number of output columns can be set by the user with the largestFaceSize
parameter.
This function exports the vertex indices of the polygonal faces of a mesh to a buffer. Indices are stored following the order the faces appear in the mesh. The buffer must be preallocated with the correct size (number of faces times largestFaceSize
). For each face that has less vertices than the largest face size, the remaining indices are set to -1.
For triangle meshes, you can set largestFaceSize
to 3. For polygonal meshes, you can use the function vcl::largestFaceSize to get the largest face size and allocate the buffer accordingly:
getIndicesAsIfContainerCompact == true
) the function stores the vertex indices as if the vertex container of the mesh is compact. This means that, if the mesh has deleted vertices, the vertex indices stored in the buffer may not correspond to the vertex indices of the mesh. If you want to store the actual vertex indices in the input mesh, set getIndicesAsIfContainerCompact
to false.[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | largestFaceSize | size of the largest face in the mesh |
[in] | storage | storage type of the matrix (row or column major) |
[in] | getIndicesAsIfContainerCompact | if true, the function will store the vertex indices as if the vertex container of the mesh is compact. If false, the actual vertex indices in the input mesh will be stored. |
[in] | rowNumber | number of rows of the matrix (if different from the number of faces in the mesh) - used only when storage is column major |
uint vcl::faceSizesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer | ||
) |
Export into a buffer the sizes of the faces of a Mesh, and return the sum of the sizes.
This function could be useful when dealing with polygonal meshes: it exports the sizes of the faces of a mesh to a buffer. Sizes are stored following the order the faces appear in the mesh. The buffer must be preallocated with the correct size (number of faces).
The return value is the sum of the sizes of the faces. This value is useful when you need to allocate a buffer to store the vertex indices of the faces (its size is the sum of the face sizes).
[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
void vcl::faceWedgeTexCoordIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer | ||
) |
Export into a buffer the per face wedge texture indices of a mesh.
This function exports the per face wedge texture coordinate indices of a mesh to a buffer. Texture coordinate indices are stored in the buffer following the order the faces appear in the mesh. The buffer must be preallocated with the correct size (number of faces).
[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
void vcl::faceWedgeTexCoordsToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
uint | largestFaceSize = 3 , |
||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR , |
||
uint | rowNumber = UINT_NULL |
||
) |
Export the selection status of the elements identified by ELEM_ID
of a mesh to a buffer.
This function exports the selection status of the elements identified by ELEM_ID
of a mesh to a buffer. Values are stored in the buffer following the order the elements appear in the mesh. The buffer must be preallocated with the correct size (number of elements).
Usage example with std::vector<bool>:
[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | largestFaceSize | size of the largest face in the mesh |
[in] | storage | storage type of the matrix (row or column major) |
[in] | rowNumber | number of rows of the matrix (if different from the number of faces in the mesh) - used only when storage is column major |
void vcl::triangulatedFaceIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
TriPolyIndexBiMap & | indexMap = detail::indexMap , |
||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR , |
||
uint | numTriangles = UINT_NULL , |
||
bool | getIndicesAsIfContainerCompact = true |
||
) |
Export into a buffer the vertex indices for each triangle computed by triangulating the faces of a Mesh.
This function exports the vertex indices of the triangles computed by triangulating the faces of a mesh to a buffer. Indices are stored following the order the faces appear in the mesh. The buffer must be preallocated with the correct size (number of resulting triangles times 3).
You can use the function vcl::countTriangulatedTriangles to get the number of resulting triangles and allocate the buffer accordingly:
The input indexMap is used to map each triangle to the face index. If the storage of the buffer is column major, the number of resulting triangles (that should be known when calling this function) should be given as input. If the number of resulting triangles is not given, the function will compute it again.
getIndicesAsIfContainerCompact == true
) the function stores the vertex indices as if the vertex container of the mesh is compact. This means that, if the mesh has deleted vertices, the vertex indices stored in the buffer may not correspond to the vertex indices of the mesh. If you want to store the actual vertex indices in the input mesh, set getIndicesAsIfContainerCompact
to false.[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[out] | indexMap | map from triangle index to face index |
[in] | storage | storage type of the matrix (row or column major) |
[in] | numTriangles | number of resulting triangles (necessary only if the storage is column major) |
[in] | getIndicesAsIfContainerCompact | if true, the function will store the vertex indices as if the vertex container of the mesh is compact. If false, the actual vertex indices in the input mesh will be stored. |
void vcl::triangulatedFaceWedgeTexCoordIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
const TriPolyIndexBiMap & | indexMap | ||
) |
Export into a buffer the per triangle wedge texture indices of a mesh. Triangles are computed by triangulating the faces of the mesh.
This function exports the per triangle wedge texture coordinate indices of a mesh to a buffer. Texture coordinate indices are stored in the buffer following the order the faces appear in the mesh. The buffer must be preallocated with the correct size (number of triangles).
The function requires an already computed index map, which maps each triangle to the face index and vice versa. You can use the vcl::triangulatedFaceIndicesToBuffer function to get the index map. You can use the function vcl::countTriangulatedTriangles to get the number of resulting triangles and allocate the buffer accordingly.
[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | indexMap | map from triangle index to face index |
void vcl::vertexCoordsToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR , |
||
uint | rowNumber = UINT_NULL |
||
) |
Export the vertex coordinates of a mesh to a buffer.
This function exports the vertex coordinates of a mesh to a buffer. Vertices are stored in the buffer following the order they appear in the mesh. The buffer must be preallocated with the correct size (number of vertices times the number of coordinates per vertex).
[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | storage | storage type of the matrix (row or column major) |
[in] | rowNumber | number of rows of the matrix (if different from the number of vertices in the mesh) - used only when storage is column major |
void vcl::wireframeIndicesToBuffer | ( | const MeshType & | mesh, |
auto * | buffer, | ||
MatrixStorageType | storage = MatrixStorageType::ROW_MAJOR , |
||
bool | getIndicesAsIfContainerCompact = true , |
||
uint | rowNumber = UINT_NULL |
||
) |
Export into a buffer the vertex indices for each edge that composes the wireframe of the Mesh (i.e., the edges of the faces).
This function exports the vertex indices of the wireframe edges of a mesh to a buffer. Indices are stored following the order the edges appear in the faces. The buffer must be preallocated with the correct size (number of references to vertices in the mesh faces times 2 - see countPerFaceVertexReferences).
getIndicesAsIfContainerCompact == true
) the function stores the vertex indices as if the vertex container of the mesh is compact. This means that, if the mesh has deleted vertices, the vertex indices stored in the buffer may not correspond to the vertex indices of the mesh. If you want to store the actual vertex indices in the input mesh, set getIndicesAsIfContainerCompact
to false.[in] | mesh | input mesh |
[out] | buffer | preallocated buffer |
[in] | storage | storage type of the matrix (row or column major) |
[in] | getIndicesAsIfContainerCompact | if true, the function will store the vertex indices as if the vertex container of the mesh is compact. If false, the actual vertex indices in the input mesh will be stored. |
[in] | rowNumber | number of rows of the matrix (if different from the number of references to vertices in the mesh faces times 2) - used only when storage is column major |