Visual Computing Library
All Classes Functions Variables Typedefs Enumerations Friends Modules Pages Concepts
mesh_render_data.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_RENDER_DRAWABLE_MESH_MESH_RENDER_DATA_H
24#define VCL_RENDER_DRAWABLE_MESH_MESH_RENDER_DATA_H
25
26#include <vclib/algorithms/mesh/import_export/append_replace_to_buffer.h>
27#include <vclib/algorithms/mesh/import_export/export_buffer.h>
28#include <vclib/algorithms/mesh/stat/topology.h>
29#include <vclib/mesh/requirements.h>
30#include <vclib/render/drawable/mesh/mesh_render_info.h>
31#include <vclib/space/complex/tri_poly_index_bimap.h>
32
33namespace vcl {
34
79template<typename MeshRenderDerived>
81{
82 using MRI = MeshRenderInfo;
83
84 // Auxiliary data that can be used by the derived class to properly allocate
85 // and fill the buffers
86
87 uint mNumVerts = 0;
88 uint mNumTris = 0;
89 uint mNumEdges = 0;
90 uint nWireframeLines = 0;
91
92 // Vector that tells, for each non-duplicated vertex, which wedges it
93 // belongs to. Each pair is the face index and the vertex index in the face.
94 // It allows to access the wedge texcoords for each non-duplicated vertex
95 std::vector<std::pair<uint, uint>> mVertWedgeMap;
96
97 // The list of vertices that has been duplicated (each element of the list
98 // is the index of the vertex to duplicate)
99 std::list<uint> mVertsToDuplicate;
100
101 // A list that tells, for each duplicated vertex, the list of faces that
102 // must be reassigned to the corresponding duplicated vertex.
103 // Each duplicated vertex has a list of pairs face/vertex index in the face,
104 // that must be/have been reassigned to the duplicated vertex
105 std::list<std::list<std::pair<uint, uint>>> mFacesToReassign;
106
107 // data used to manage the mapping beteween the original polygonal faces
108 // and the triangle faces
109
110 // map that stores the correspondence between the original polygonal faces
111 // and the triangle faces
112 TriPolyIndexBiMap mIndexMap;
113
114 // bitset that tells which buffers must be filled (this value has been set
115 // at construction time). It may differ from the value passed to the update
116 // function, since the user may want to update only a subset of the buffers
117 MRI::BuffersBitSet mBuffersToFill = MRI::BUFFERS_ALL;
118
119public:
127 void update(
128 const MeshConcept auto& mesh,
129 MRI::BuffersBitSet buffersToUpdate = MRI::BUFFERS_ALL)
130 {
131 using enum MRI::Buffers;
132
133 MRI::BuffersBitSet btu = mBuffersToFill & buffersToUpdate;
134
135 // first thing to do
136 updateAuxiliaryData(mesh, btu);
137
138 // set data for vertices
139 updateVerticesData(mesh, btu);
140
141 // set data for faces
142 updateFacesData(mesh, btu);
143
144 // set data for edges
145 updateEdgesData(mesh, btu);
146
147 // set data for mesh
148 updateMeshData(mesh, btu);
149
150 // set data for textures
151 updateTextureData(mesh, btu);
152 }
153
154protected:
155 MeshRenderData() = default;
156
157 MeshRenderData(MRI::BuffersBitSet buffersToFill) :
158 mBuffersToFill(buffersToFill)
159 {
160 }
161
162 void swap(MeshRenderData& other)
163 {
164 using std::swap;
165 swap(mNumVerts, other.mNumVerts);
166 swap(mNumTris, other.mNumTris);
167 swap(mVertWedgeMap, other.mVertWedgeMap);
168 swap(mVertsToDuplicate, other.mVertsToDuplicate);
169 swap(mFacesToReassign, other.mFacesToReassign);
170 swap(mIndexMap, other.mIndexMap);
171 swap(mBuffersToFill, other.mBuffersToFill);
172 }
173
200 uint numVerts() const { return mNumVerts; }
201
228 uint numTris() const { return mNumTris; }
229
252 uint numEdges() const { return mNumEdges; }
253
281 uint numWireframeLines() const { return nWireframeLines; }
282
283 // utility functions to fill the buffers
284
294 void fillVertexCoords(const MeshConcept auto& mesh, auto* buffer)
295 {
296 vertexCoordsToBuffer(mesh, buffer);
297 appendDuplicateVertexCoordsToBuffer(mesh, mVertsToDuplicate, buffer);
298 }
299
309 void fillVertexNormals(const MeshConcept auto& mesh, auto* buffer)
310 {
311 vertexNormalsToBuffer(mesh, buffer);
312 appendDuplicateVertexNormalsToBuffer(mesh, mVertsToDuplicate, buffer);
313 }
314
325 const MeshConcept auto& mesh,
326 auto* buffer,
328 {
329 vertexColorsToBuffer(mesh, buffer, fmt);
331 mesh, mVertsToDuplicate, buffer, fmt);
332 }
333
343 void fillVertexTexCoords(const MeshConcept auto& mesh, auto* buffer)
344 {
345 vertexTexCoordsToBuffer(mesh, buffer);
346 appendDuplicateVertexTexCoordsToBuffer(mesh, mVertsToDuplicate, buffer);
347 }
348
363 void fillWedgeTexCoords(const FaceMeshConcept auto& mesh, auto* buffer)
364 {
366 mesh, mVertWedgeMap, mFacesToReassign, buffer);
367 }
368
378 void fillTriangleIndices(const FaceMeshConcept auto& mesh, auto* buffer)
379 {
381 mesh, buffer, mIndexMap, MatrixStorageType::ROW_MAJOR, mNumTris);
383 mesh, mVertsToDuplicate, mFacesToReassign, mIndexMap, buffer);
384 }
385
395 void fillTriangleNormals(const FaceMeshConcept auto& mesh, auto* buffer)
396 {
398 mesh, buffer, mIndexMap, MatrixStorageType::ROW_MAJOR);
399 }
400
411 const FaceMeshConcept auto& mesh,
412 auto* buffer,
414 {
415 triangulatedFaceColorsToBuffer(mesh, buffer, mIndexMap, fmt);
416 }
417
432 const FaceMeshConcept auto& mesh,
433 auto* buffer)
434 {
436 mesh, buffer, mIndexMap);
437 }
438
448 void fillWedgeTextureIndices(const FaceMeshConcept auto& mesh, auto* buffer)
449 {
450 triangulatedFaceWedgeTexCoordIndicesToBuffer(mesh, buffer, mIndexMap);
451 }
452
462 void fillEdgeIndices(const EdgeMeshConcept auto& mesh, auto* buffer)
463 {
464 edgeIndicesToBuffer(mesh, buffer);
465 }
466
476 void fillEdgeNormals(const EdgeMeshConcept auto& mesh, auto* buffer)
477 {
478 edgeNormalsToBuffer(mesh, buffer);
479 }
480
491 const EdgeMeshConcept auto& mesh,
492 auto* buffer,
494 {
495 edgeColorsToBuffer(mesh, buffer, fmt);
496 }
497
508 void fillWireframeIndices(const FaceMeshConcept auto& mesh, auto* buffer)
509 {
510 wireframeIndicesToBuffer(mesh, buffer);
511 }
512
513 // functions that must be may implemented by the derived classes to set
514 // the buffers:
515
530
548
566
584
607
625
643
661
683
701
719
737
755
773
789 void setTextureUnits(const MeshConcept auto&) {}
790
799 void setMeshUniforms(const MeshConcept auto&) {}
800
801private:
802 MeshRenderDerived& derived()
803 {
804 return static_cast<MeshRenderDerived&>(*this);
805 }
806
807 const MeshRenderDerived& derived() const
808 {
809 return static_cast<const MeshRenderDerived&>(*this);
810 }
811
812 void updateAuxiliaryData(
813 const MeshConcept auto& mesh,
814 MeshRenderInfo::BuffersBitSet btu)
815 {
816 using MeshType = MeshRenderDerived::MeshType;
817 using enum MRI::Buffers;
818
819 if (btu[toUnderlying(VERTICES)] || btu[toUnderlying(WEDGE_TEXCOORDS)] ||
820 btu[toUnderlying(TRIANGLES)]) {
821 mVertWedgeMap.clear();
822 mVertsToDuplicate.clear();
823 mFacesToReassign.clear();
824
825 if constexpr (HasPerFaceWedgeTexCoords<MeshType>) {
826 if (mesh.isPerFaceWedgeTexCoordsEnabled()) {
827 countVerticesToDuplicateByWedgeTexCoords(
828 mesh,
829 mVertWedgeMap,
830 mVertsToDuplicate,
831 mFacesToReassign);
832 }
833 }
834
835 mNumVerts = mesh.vertexNumber() + mVertsToDuplicate.size();
836 }
837
838 if constexpr (HasFaces<MeshType>) {
839 if (btu[toUnderlying(TRIANGLES)])
840 mNumTris = countTriangulatedTriangles(mesh);
841 if (btu[toUnderlying(WIREFRAME)])
842 nWireframeLines = countPerFaceVertexReferences(mesh);
843 }
844
845 if constexpr (HasEdges<MeshType>) {
846 if (btu[toUnderlying(EDGES)])
847 mNumEdges = mesh.edgeNumber();
848 }
849 }
850
851 void updateVerticesData(
852 const MeshConcept auto& mesh,
853 MeshRenderInfo::BuffersBitSet btu)
854 {
855 using MeshType = MeshRenderDerived::MeshType;
856 using enum MRI::Buffers;
857
858 if (btu[toUnderlying(VERTICES)]) {
859 // vertex buffer (coordinates)
860 derived().setVertexCoordsBuffer(mesh);
861 }
862
863 if constexpr (vcl::HasPerVertexNormal<MeshType>) {
864 if (vcl::isPerVertexNormalAvailable(mesh)) {
865 if (btu[toUnderlying(VERT_NORMALS)]) {
866 // vertex buffer (normals)
867 derived().setVertexNormalsBuffer(mesh);
868 }
869 }
870 }
871
872 if constexpr (vcl::HasPerVertexColor<MeshType>) {
873 if (vcl::isPerVertexColorAvailable(mesh)) {
874 if (btu[toUnderlying(VERT_COLORS)]) {
875 // vertex buffer (colors)
876 derived().setVertexColorsBuffer(mesh);
877 }
878 }
879 }
880
882 if (vcl::isPerVertexTexCoordAvailable(mesh)) {
883 if (btu[toUnderlying(VERT_TEXCOORDS)]) {
884 // vertex buffer (UVs)
885 derived().setVertexTexCoordsBuffer(mesh);
886 }
887 }
888 }
889 }
890
891 void updateFacesData(
892 const MeshConcept auto& mesh,
893 MeshRenderInfo::BuffersBitSet btu)
894 {
895 using MeshType = MeshRenderDerived::MeshType;
896 using enum MRI::Buffers;
897
898 if constexpr (vcl::HasFaces<MeshType>) {
899 if (btu[toUnderlying(TRIANGLES)]) {
900 // triangle index buffer
901 derived().setTriangleIndicesBuffer(mesh);
902 }
903
906 if (btu[toUnderlying(WEDGE_TEXCOORDS)]) {
907 // vertex wedges buffer (duplicated vertices)
908 derived().setWedgeTexCoordsBuffer(mesh);
909 }
910 }
911 }
912
913 if constexpr (vcl::HasPerFaceNormal<MeshType>) {
915 if (btu[toUnderlying(TRI_NORMALS)]) {
916 // triangle normal buffer
917 derived().setTriangleNormalsBuffer(mesh);
918 }
919 }
920 }
921
922 if constexpr (vcl::HasPerFaceColor<MeshType>) {
924 if (btu[toUnderlying(TRI_COLORS)]) {
925 // triangle color buffer
926 derived().setTriangleColorsBuffer(mesh);
927 }
928 }
929 }
930
931 // texture indices are stored per face (each face has its own
932 // texture index)
934 if (vcl::isPerVertexTexCoordAvailable(mesh)) {
935 if (btu[toUnderlying(VERT_TEXCOORDS)]) {
936 // triangle vertex texture indices buffer
937 derived().setVertexTextureIndicesBuffer(mesh);
938 }
939 }
940 }
941
944 if (btu[toUnderlying(WEDGE_TEXCOORDS)]) {
945 // triangle wedge texture indices buffer
946 derived().setWedgeTextureIndicesBuffer(mesh);
947 }
948 }
949 }
950
951 if (btu[toUnderlying(WIREFRAME)]) {
952 // wireframe index buffer
953 derived().setWireframeIndicesBuffer(mesh);
954 }
955 }
956 }
957
958 void updateEdgesData(
959 const MeshConcept auto& mesh,
960 MeshRenderInfo::BuffersBitSet btu)
961 {
962 using MeshType = MeshRenderDerived::MeshType;
963 using enum MRI::Buffers;
964
965 if constexpr (vcl::HasEdges<MeshType>) {
966 if (btu[toUnderlying(EDGES)]) {
967 // edge index buffer
968 derived().setEdgeIndicesBuffer(mesh);
969 }
970
971 if constexpr (vcl::HasPerEdgeNormal<MeshType>) {
973 if (btu[toUnderlying(EDGE_NORMALS)]) {
974 // edge normal buffer
975 derived().setEdgeNormalsBuffer(mesh);
976 }
977 }
978 }
979
980 if constexpr (vcl::HasPerEdgeColor<MeshType>) {
982 if (btu[toUnderlying(EDGE_COLORS)]) {
983 // edge color buffer
984 derived().setEdgeColorsBuffer(mesh);
985 }
986 }
987 }
988 }
989 }
990
991 void updateMeshData(
992 const MeshConcept auto& mesh,
993 MeshRenderInfo::BuffersBitSet btu)
994 {
995 using enum MRI::Buffers;
996
997 if (btu[toUnderlying(MESH_UNIFORMS)]) {
998 // mesh uniforms
999 derived().setMeshUniforms(mesh);
1000 }
1001 }
1002
1003 void updateTextureData(
1004 const MeshConcept auto& mesh,
1005 MeshRenderInfo::BuffersBitSet btu)
1006 {
1007 using MeshType = MeshRenderDerived::MeshType;
1008 using enum MRI::Buffers;
1009
1010 if constexpr (vcl::HasTexturePaths<MeshType>) {
1011 if (btu[toUnderlying(TEXTURES)]) {
1012 // textures
1013 derived().setTextureUnits(mesh);
1014 }
1015 }
1016 }
1017};
1018
1019} // namespace vcl
1020
1021#endif // VCL_RENDER_DRAWABLE_MESH_MESH_RENDER_DATA_H
The BitSet class allows to treat an integral type as an array of booleans of a guaranteed size.
Definition bit_set.h:53
Format
Color format enumeration.
Definition color.h:77
The MeshRenderData class provides a common interface to automatically update the buffers used to rend...
Definition mesh_render_data.h:81
void fillVertexCoords(const MeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex coordinates of the mesh.
Definition mesh_render_data.h:294
void setTriangleIndicesBuffer(const FaceMeshConcept auto &)
Function that sets the content of triangle indices buffer and sends the data to the GPU.
Definition mesh_render_data.h:624
void setEdgeIndicesBuffer(const EdgeMeshConcept auto &)
Function that sets the content of edge indices buffer and sends the data to the GPU.
Definition mesh_render_data.h:736
uint numWireframeLines() const
Returns the number of wireframe lines that will be used to render the mesh.
Definition mesh_render_data.h:281
void setVertexColorsBuffer(const MeshConcept auto &)
Function that sets the content of vertex colors buffer and sends the data to the GPU.
Definition mesh_render_data.h:565
void setEdgeNormalsBuffer(const EdgeMeshConcept auto &)
Function that sets the content of edge normals buffer and sends the data to the GPU.
Definition mesh_render_data.h:754
void fillEdgeIndices(const EdgeMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the edge indices of the mesh.
Definition mesh_render_data.h:462
void fillWedgeTextureIndices(const FaceMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the wedge texture indices of the mesh...
Definition mesh_render_data.h:448
void setEdgeColorsBuffer(const EdgeMeshConcept auto &)
Function that sets the content of edge colors buffer and sends the data to the GPU.
Definition mesh_render_data.h:772
uint numVerts() const
Returns the number of vertices that will be used to render the mesh.
Definition mesh_render_data.h:200
void setTextureUnits(const MeshConcept auto &)
Function that sets the texture units from the mesh and sends the data to the GPU.
Definition mesh_render_data.h:789
void setWedgeTextureIndicesBuffer(const FaceMeshConcept auto &)
Function that sets the content of wedge texture indices buffer and sends the data to the GPU.
Definition mesh_render_data.h:700
void fillWireframeIndices(const FaceMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the wireframe indices of the mesh.
Definition mesh_render_data.h:508
void fillEdgeNormals(const EdgeMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the edge normals of the mesh.
Definition mesh_render_data.h:476
void fillTriangleColors(const FaceMeshConcept auto &mesh, auto *buffer, Color::Format fmt)
Given the mesh and a pointer to a buffer, fills the buffer with the triangle colors of the mesh (each...
Definition mesh_render_data.h:410
uint numTris() const
Returns the number of triangles that will be used to render the mesh.
Definition mesh_render_data.h:228
void fillEdgeColors(const EdgeMeshConcept auto &mesh, auto *buffer, Color::Format fmt)
Given the mesh and a pointer to a buffer, fills the buffer with the edge colors of the mesh (each col...
Definition mesh_render_data.h:490
uint numEdges() const
Returns the number of edges that will be used to render the mesh.
Definition mesh_render_data.h:252
void setVertexCoordsBuffer(const MeshConcept auto &)
Function that sets the content of vertex coordinates buffer and sends the data to the GPU.
Definition mesh_render_data.h:529
void setVertexTexCoordsBuffer(const MeshConcept auto &)
Function that sets the content of vertex texture coordinates buffer and sends the data to the GPU.
Definition mesh_render_data.h:583
void fillTriangleNormals(const FaceMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the triangle normals of the mesh.
Definition mesh_render_data.h:395
void update(const MeshConcept auto &mesh, MRI::BuffersBitSet buffersToUpdate=MRI::BUFFERS_ALL)
Update the buffers used to render the mesh.
Definition mesh_render_data.h:127
void fillVertexTexCoords(const MeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex texcoords of the mesh.
Definition mesh_render_data.h:343
void setTriangleColorsBuffer(const FaceMeshConcept auto &)
Function that sets the content of triangle colors buffer and sends the data to the GPU.
Definition mesh_render_data.h:660
void setVertexTextureIndicesBuffer(const FaceMeshConcept auto &)
Function that sets the content of vertex texture indices buffer and sends the data to the GPU.
Definition mesh_render_data.h:682
void setVertexNormalsBuffer(const MeshConcept auto &)
Function that sets the content of vertex normals buffer and sends the data to the GPU.
Definition mesh_render_data.h:547
void fillTriangleIndices(const FaceMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the triangle indices of the mesh.
Definition mesh_render_data.h:378
void setWireframeIndicesBuffer(const FaceMeshConcept auto &)
Function that sets the content of wireframe indices buffer and sends the data to the GPU.
Definition mesh_render_data.h:718
void fillVertexNormals(const MeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex normals of the mesh.
Definition mesh_render_data.h:309
void fillWedgeTexCoords(const FaceMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the wedge texcoors of the mesh.
Definition mesh_render_data.h:363
void setMeshUniforms(const MeshConcept auto &)
Function that sets the mesh uniforms from the mesh.
Definition mesh_render_data.h:799
void setWedgeTexCoordsBuffer(const MeshConcept auto &)
Function that sets the content of wedge texture coordinates buffer and sends the data to the GPU.
Definition mesh_render_data.h:606
void fillVertexColors(const MeshConcept auto &mesh, auto *buffer, Color::Format fmt)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex colors of the mesh (each c...
Definition mesh_render_data.h:324
void setTriangleNormalsBuffer(const FaceMeshConcept auto &)
Function that sets the content of triangle normals buffer and sends the data to the GPU.
Definition mesh_render_data.h:642
void fillVertexTextureIndices(const FaceMeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex texture indices of the mes...
Definition mesh_render_data.h:431
The MeshRenderInfo class is a collection of rendering settings for a Mesh.
Definition mesh_render_info.h:61
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
The TriPolyIndexBiMap class allows to store a bidirectional mapping between a Polygon Mesh and a Tria...
Definition tri_poly_index_bimap.h:50
The EdgeMeshConcept is evaluated true if the type T is a Mesh (it satisfies the vcl::MeshConcept) and...
Definition mesh_concept.h:209
The FaceMeshConcept is evaluated true if the type T is a Mesh (it satisfies the vcl::MeshConcept) and...
Definition mesh_concept.h:218
HasEdges concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition edge_container.h:131
HasFaces concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition face_container.h:133
Concept that checks if a Mesh has the per Edge Color component.
Definition per_edge.h:97
Concept that checks if a Mesh has the per Edge Normal component.
Definition per_edge.h:142
Concept that checks if a Mesh has the per Face Color component.
Definition per_face.h:111
Concept that checks if a Mesh has the per Face Normal component.
Definition per_face.h:158
Concept that checks if a Mesh has the per Face WedgeTexCoords component.
Definition per_face.h:270
Concept that checks if a Mesh has the per Vertex Color component.
Definition per_vertex.h:98
Concept that checks if a Mesh has the per Vertex Normal component.
Definition per_vertex.h:128
Concept that checks if a Mesh has the per Vertex TexCoord component.
Definition per_vertex.h:174
Concept that checks if a Mesh has the TexturePaths component.
Definition per_mesh.h:112
The Mesh Concept is evaluated to true when the type is a Mesh.
Definition mesh_concept.h:77
void 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.
Definition export_buffer.h:1710
void 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.
Definition append_replace_to_buffer.h:101
void 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 duplicat...
Definition append_replace_to_buffer.h:253
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:467
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:398
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:662
bool isPerEdgeColorAvailable(const MeshType &m)
Returns true if the Color component is available (enabled) in the Edge element of the input mesh m.
Definition edge_requirements.h:214
bool isPerEdgeNormalAvailable(const MeshType &m)
Returns true if the Normal component is available (enabled) in the Edge element of the input mesh m.
Definition edge_requirements.h:330
void 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 Me...
Definition export_buffer.h:357
void 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 tria...
Definition export_buffer.h:1649
void 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.
Definition export_buffer.h:451
void 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.
Definition export_buffer.h:101
void 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....
Definition export_buffer.h:510
bool isPerFaceWedgeTexCoordsAvailable(const MeshType &m)
Returns true if the WedgeTexCoords component is available (enabled) in the Face element of the input ...
Definition face_requirements.h:571
bool isPerFaceNormalAvailable(const MeshType &m)
Returns true if the Normal component is available (enabled) in the Face element of the input mesh m.
Definition face_requirements.h:330
bool isPerFaceColorAvailable(const MeshType &m)
Returns true if the Color component is available (enabled) in the Face element of the input mesh m.
Definition face_requirements.h:214