Visual Computing Library  devel
Loading...
Searching...
No Matches
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 fillVertexPositions(const MeshConcept auto& mesh, auto* buffer)
295 {
296 vertexPositionsToBuffer(mesh, buffer);
297 appendDuplicateVertexPositionsToBuffer(mesh, mVertsToDuplicate, buffer);
298 }
299
310 void fillVertexQuadIndices(const MeshConcept auto& mesh, auto* buffer)
311 {
312 vertexQuadIndicesToBuffer(mesh, buffer);
313 }
314
324 void fillVertexNormals(const MeshConcept auto& mesh, auto* buffer)
325 {
326 vertexNormalsToBuffer(mesh, buffer);
327 appendDuplicateVertexNormalsToBuffer(mesh, mVertsToDuplicate, buffer);
328 }
329
340 const MeshConcept auto& mesh,
341 auto* buffer,
343 {
344 vertexColorsToBuffer(mesh, buffer, fmt);
346 mesh, mVertsToDuplicate, buffer, fmt);
347 }
348
358 void fillVertexTexCoords(const MeshConcept auto& mesh, auto* buffer)
359 {
360 vertexTexCoordsToBuffer(mesh, buffer);
361 appendDuplicateVertexTexCoordsToBuffer(mesh, mVertsToDuplicate, buffer);
362 }
363
378 void fillWedgeTexCoords(const FaceMeshConcept auto& mesh, auto* buffer)
379 {
381 mesh, mVertWedgeMap, mFacesToReassign, buffer);
382 }
383
393 void fillTriangleIndices(const FaceMeshConcept auto& mesh, auto* buffer)
394 {
396 mesh, buffer, mIndexMap, MatrixStorageType::ROW_MAJOR, mNumTris);
398 mesh, mVertsToDuplicate, mFacesToReassign, mIndexMap, buffer);
399 }
400
410 void fillTriangleNormals(const FaceMeshConcept auto& mesh, auto* buffer)
411 {
413 mesh, buffer, mIndexMap, MatrixStorageType::ROW_MAJOR);
414 }
415
426 const FaceMeshConcept auto& mesh,
427 auto* buffer,
429 {
430 triangulatedFaceColorsToBuffer(mesh, buffer, mIndexMap, fmt);
431 }
432
447 const FaceMeshConcept auto& mesh,
448 auto* buffer)
449 {
451 mesh, buffer, mIndexMap);
452 }
453
463 void fillWedgeTextureIndices(const FaceMeshConcept auto& mesh, auto* buffer)
464 {
465 triangulatedFaceWedgeTexCoordIndicesToBuffer(mesh, buffer, mIndexMap);
466 }
467
477 void fillEdgeIndices(const EdgeMeshConcept auto& mesh, auto* buffer)
478 {
479 edgeIndicesToBuffer(mesh, buffer);
480 }
481
491 void fillEdgeNormals(const EdgeMeshConcept auto& mesh, auto* buffer)
492 {
493 edgeNormalsToBuffer(mesh, buffer);
494 }
495
506 const EdgeMeshConcept auto& mesh,
507 auto* buffer,
509 {
510 edgeColorsToBuffer(mesh, buffer, fmt);
511 }
512
523 void fillWireframeIndices(const FaceMeshConcept auto& mesh, auto* buffer)
524 {
525 wireframeIndicesToBuffer(mesh, buffer);
526 }
527
528 // functions that must be may implemented by the derived classes to set
529 // the buffers:
530
545
563
581
599
622
640
658
676
698
716
734
752
770
788
804 void setTextureUnits(const MeshConcept auto&) {}
805
814 void setMeshUniforms(const MeshConcept auto&) {}
815
816private:
817 MeshRenderDerived& derived()
818 {
819 return static_cast<MeshRenderDerived&>(*this);
820 }
821
822 const MeshRenderDerived& derived() const
823 {
824 return static_cast<const MeshRenderDerived&>(*this);
825 }
826
827 void updateAuxiliaryData(
828 const MeshConcept auto& mesh,
829 MeshRenderInfo::BuffersBitSet btu)
830 {
831 using MeshType = MeshRenderDerived::MeshType;
832 using enum MRI::Buffers;
833
834 if (btu[toUnderlying(VERTICES)] || btu[toUnderlying(WEDGE_TEXCOORDS)] ||
835 btu[toUnderlying(TRIANGLES)]) {
836 mVertWedgeMap.clear();
837 mVertsToDuplicate.clear();
838 mFacesToReassign.clear();
839
840 if constexpr (HasPerFaceWedgeTexCoords<MeshType>) {
841 if (mesh.isPerFaceWedgeTexCoordsEnabled()) {
843 mesh,
844 mVertWedgeMap,
845 mVertsToDuplicate,
846 mFacesToReassign);
847 }
848 }
849
850 mNumVerts = mesh.vertexNumber() + mVertsToDuplicate.size();
851 }
852
853 if constexpr (HasFaces<MeshType>) {
854 if (btu[toUnderlying(TRIANGLES)])
855 mNumTris = countTriangulatedTriangles(mesh);
856 if (btu[toUnderlying(WIREFRAME)])
857 nWireframeLines = countPerFaceVertexReferences(mesh);
858 }
859
860 if constexpr (HasEdges<MeshType>) {
861 if (btu[toUnderlying(EDGES)])
862 mNumEdges = mesh.edgeNumber();
863 }
864 }
865
866 void updateVerticesData(
867 const MeshConcept auto& mesh,
868 MeshRenderInfo::BuffersBitSet btu)
869 {
870 using MeshType = MeshRenderDerived::MeshType;
871 using enum MRI::Buffers;
872
873 if (btu[toUnderlying(VERTICES)]) {
874 // vertex buffer (positions)
875 derived().setVertexPositionsBuffer(mesh);
876 }
877
878 if constexpr (vcl::HasPerVertexNormal<MeshType>) {
879 if (vcl::isPerVertexNormalAvailable(mesh)) {
880 if (btu[toUnderlying(VERT_NORMALS)]) {
881 // vertex buffer (normals)
882 derived().setVertexNormalsBuffer(mesh);
883 }
884 }
885 }
886
887 if constexpr (vcl::HasPerVertexColor<MeshType>) {
888 if (vcl::isPerVertexColorAvailable(mesh)) {
889 if (btu[toUnderlying(VERT_COLORS)]) {
890 // vertex buffer (colors)
891 derived().setVertexColorsBuffer(mesh);
892 }
893 }
894 }
895
897 if (vcl::isPerVertexTexCoordAvailable(mesh)) {
898 if (btu[toUnderlying(VERT_TEXCOORDS)]) {
899 // vertex buffer (UVs)
900 derived().setVertexTexCoordsBuffer(mesh);
901 }
902 }
903 }
904 }
905
906 void updateFacesData(
907 const MeshConcept auto& mesh,
908 MeshRenderInfo::BuffersBitSet btu)
909 {
910 using MeshType = MeshRenderDerived::MeshType;
911 using enum MRI::Buffers;
912
913 if constexpr (vcl::HasFaces<MeshType>) {
914 if (btu[toUnderlying(TRIANGLES)]) {
915 // triangle index buffer
916 derived().setTriangleIndicesBuffer(mesh);
917 }
918
921 if (btu[toUnderlying(WEDGE_TEXCOORDS)]) {
922 // vertex wedges buffer (duplicated vertices)
923 derived().setWedgeTexCoordsBuffer(mesh);
924 }
925 }
926 }
927
928 if constexpr (vcl::HasPerFaceNormal<MeshType>) {
930 if (btu[toUnderlying(TRI_NORMALS)]) {
931 // triangle normal buffer
932 derived().setTriangleNormalsBuffer(mesh);
933 }
934 }
935 }
936
937 if constexpr (vcl::HasPerFaceColor<MeshType>) {
939 if (btu[toUnderlying(TRI_COLORS)]) {
940 // triangle color buffer
941 derived().setTriangleColorsBuffer(mesh);
942 }
943 }
944 }
945
946 // texture indices are stored per face (each face has its own
947 // texture index)
949 if (vcl::isPerVertexTexCoordAvailable(mesh)) {
950 if (btu[toUnderlying(VERT_TEXCOORDS)]) {
951 // triangle vertex texture indices buffer
952 derived().setVertexTextureIndicesBuffer(mesh);
953 }
954 }
955 }
956
959 if (btu[toUnderlying(WEDGE_TEXCOORDS)]) {
960 // triangle wedge texture indices buffer
961 derived().setWedgeTextureIndicesBuffer(mesh);
962 }
963 }
964 }
965
966 if (btu[toUnderlying(WIREFRAME)]) {
967 // wireframe index buffer
968 derived().setWireframeIndicesBuffer(mesh);
969 }
970 }
971 }
972
973 void updateEdgesData(
974 const MeshConcept auto& mesh,
975 MeshRenderInfo::BuffersBitSet btu)
976 {
977 using MeshType = MeshRenderDerived::MeshType;
978 using enum MRI::Buffers;
979
980 if constexpr (vcl::HasEdges<MeshType>) {
981 if (btu[toUnderlying(EDGES)]) {
982 // edge index buffer
983 derived().setEdgeIndicesBuffer(mesh);
984 }
985
986 if constexpr (vcl::HasPerEdgeNormal<MeshType>) {
988 if (btu[toUnderlying(EDGE_NORMALS)]) {
989 // edge normal buffer
990 derived().setEdgeNormalsBuffer(mesh);
991 }
992 }
993 }
994
995 if constexpr (vcl::HasPerEdgeColor<MeshType>) {
997 if (btu[toUnderlying(EDGE_COLORS)]) {
998 // edge color buffer
999 derived().setEdgeColorsBuffer(mesh);
1000 }
1001 }
1002 }
1003 }
1004 }
1005
1006 void updateMeshData(
1007 const MeshConcept auto& mesh,
1008 MeshRenderInfo::BuffersBitSet btu)
1009 {
1010 using enum MRI::Buffers;
1011
1012 if (btu[toUnderlying(MESH_UNIFORMS)]) {
1013 // mesh uniforms
1014 derived().setMeshUniforms(mesh);
1015 }
1016 }
1017
1018 void updateTextureData(
1019 const MeshConcept auto& mesh,
1020 MeshRenderInfo::BuffersBitSet btu)
1021 {
1022 using MeshType = MeshRenderDerived::MeshType;
1023 using enum MRI::Buffers;
1024
1025 if constexpr (vcl::HasTexturePaths<MeshType>) {
1026 if (btu[toUnderlying(TEXTURES)]) {
1027 // textures
1028 derived().setTextureUnits(mesh);
1029 }
1030 }
1031 }
1032};
1033
1034} // namespace vcl
1035
1036#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:52
A class representing a box in N-dimensional space.
Definition box.h:46
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 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:639
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:751
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:580
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:769
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:477
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:463
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:787
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:804
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:715
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:523
void fillVertexPositions(const MeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex positions of the mesh.
Definition mesh_render_data.h:294
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:491
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:425
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:505
uint numEdges() const
Returns the number of edges that will be used to render the mesh.
Definition mesh_render_data.h:252
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:598
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:410
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:358
void fillVertexQuadIndices(const MeshConcept auto &mesh, auto *buffer)
Given the mesh and a pointer to a buffer, fills the buffer with the vertex quad indices of the mesh (...
Definition mesh_render_data.h:310
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:675
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:697
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:562
void setVertexPositionsBuffer(const MeshConcept auto &)
Function that sets the content of vertex positions buffer and sends the data to the GPU.
Definition mesh_render_data.h:544
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:393
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:733
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:324
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:378
void setMeshUniforms(const MeshConcept auto &)
Function that sets the mesh uniforms from the mesh.
Definition mesh_render_data.h:814
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:621
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:339
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:657
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:446
The MeshRenderInfo class is a collection of rendering settings for a Mesh.
Definition mesh_render_info.h:61
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 edge_requirements.h:58
The FaceMeshConcept is evaluated true if the type T is a Mesh (it satisfies the vcl::MeshConcept) and...
Definition face_requirements.h:70
HasEdges concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition edge_container.h:1064
HasFaces concepts is satisfied when at least one of its template types is (or inherits from) a vcl::m...
Definition face_container.h:1389
Concept that checks if a Mesh has the per Edge Color component.
Definition edge_requirements.h:118
Concept that checks if a Mesh has the per Edge Normal component.
Definition edge_requirements.h:163
Concept that checks if a Mesh has the per Face Color component.
Definition face_requirements.h:141
Concept that checks if a Mesh has the per Face Normal component.
Definition face_requirements.h:188
Concept that checks if a Mesh has the per Face WedgeTexCoords component.
Definition face_requirements.h:300
Concept that checks if a Mesh has the per Vertex Color component.
Definition vertex_requirements.h:110
Concept that checks if a Mesh has the per Vertex Normal component.
Definition vertex_requirements.h:140
Concept that checks if a Mesh has the per Vertex TexCoord component.
Definition vertex_requirements.h:186
Concept that checks if a Mesh has the TexturePaths component.
Definition mesh_requirements.h:105
A concept that checks whether a class is (inherits from) a Mesh class.
Definition mesh.h:2167
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:100
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:1756
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:252
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:466
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:397
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:661
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:370
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:486
void vertexPositionsToBuffer(const MeshType &mesh, auto *buffer, MatrixStorageType storage=MatrixStorageType::ROW_MAJOR, uint rowNumber=UINT_NULL)
Export the vertex positions of a mesh to a buffer.
Definition export_buffer.h:100
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:403
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:1695
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:497
void vertexQuadIndicesToBuffer(const MeshType &mesh, auto *buffer)
Export the indices of a quad per vertex to a buffer.
Definition export_buffer.h:142
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:556
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:833
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:592
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:476
uint countVerticesToDuplicateByWedgeTexCoords(const MeshType &mesh, std::vector< std::pair< uint, uint > > &vertWedgeMap=detail::dummyVectorOfPairs, std::list< uint > &vertsToDuplicate=detail::dummyUintList, std::list< std::list< std::pair< uint, uint > > > &facesToReassign=detail::dummyListOfLists)
This function counts the number of vertices that must be duplicated in a mesh to have a unique texcoo...
Definition topology.h:279
uint countPerFaceVertexReferences(const FaceMeshConcept auto &mesh)
Count the number of references to vertices in the mesh faces.
Definition topology.h:182
uint countTriangulatedTriangles(const FaceMeshConcept auto &mesh)
Counts the number of resulting triangles if the input mesh would be triangulated by splitting each fa...
Definition topology.h:239