ChunkBuilder.hpp
Go to the documentation of this file.
1 
35 #ifndef CHUNK_BUILDER_HPP
36 #define CHUNK_BUILDER_HPP
37 
39 #include "lvr2/io/Model.hpp"
40 
41 #include <unordered_map>
42 
43 namespace lvr2
44 {
45 
46 class ChunkBuilder;
47 
48 using ChunkBuilderPtr = std::shared_ptr<ChunkBuilder>;
49 
50 class ChunkBuilder : public std::enable_shared_from_this<ChunkBuilder>
51 {
52  public:
60  std::shared_ptr<HalfEdgeMesh<BaseVector<float>>> originalMesh,
61  std::shared_ptr<std::unordered_map<unsigned int, std::vector<std::weak_ptr<ChunkBuilder>>>>
62  vertexUse);
63 
64  ~ChunkBuilder();
65 
74  void addFace(const FaceHandle& index);
75 
84  void addDuplicateVertex(const VertexHandle& index);
85 
105  buildMesh(MeshBufferPtr attributedMesh,
106  std::shared_ptr<std::unordered_map<unsigned int, unsigned int>> splitVertices,
107  std::shared_ptr<std::unordered_map<unsigned int, unsigned int>> splitFaces) const;
108 
118  unsigned int numFaces() const;
119 
128  unsigned int numVertices() const;
129 
130  private:
131  // model that is being chunked
132  std::shared_ptr<HalfEdgeMesh<BaseVector<float>>> m_originalMesh = nullptr;
133 
134  // amount of added vertcices
135  unsigned int m_numVertices = 0;
136 
137  // indices of vertices of this chunk that got dupliplicated during the chunking process
138  std::vector<VertexHandle> m_duplicateVertices;
139 
140  // indices of faces in original model
141  std::vector<FaceHandle> m_faces;
142 
143  // one dynamic sized vector with ChunkBuilder ids for all vertices of the original mesh for
144  // duplicate detection
145  std::shared_ptr<std::unordered_map<unsigned int, std::vector<std::weak_ptr<ChunkBuilder>>>>
147 };
148 
149 } /* namespace lvr2 */
150 
151 #endif // CHUNK_BUILDER_HPP
std::vector< VertexHandle > m_duplicateVertices
Handle to access vertices of the mesh.
Definition: Handles.hpp:146
unsigned int numVertices() const
numVertices amount of vertices ot the resulting mesh
std::shared_ptr< std::unordered_map< unsigned int, std::vector< std::weak_ptr< ChunkBuilder > > > > m_vertexUse
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
std::shared_ptr< ChunkBuilder > ChunkBuilderPtr
void addDuplicateVertex(const VertexHandle &index)
addDuplicateVertex marks a vertex as duplicate
Half-edge data structure implementing the BaseMesh interface.
void addFace(const FaceHandle &index)
assigns a face to the chunk this builder is generating
MeshBufferPtr buildMesh(MeshBufferPtr attributedMesh, std::shared_ptr< std::unordered_map< unsigned int, unsigned int >> splitVertices, std::shared_ptr< std::unordered_map< unsigned int, unsigned int >> splitFaces) const
buildMesh builds a chunk by generating a new mesh buffer
std::shared_ptr< HalfEdgeMesh< BaseVector< float > > > m_originalMesh
std::vector< FaceHandle > m_faces
unsigned int m_numVertices
ChunkBuilder(std::shared_ptr< HalfEdgeMesh< BaseVector< float >>> originalMesh, std::shared_ptr< std::unordered_map< unsigned int, std::vector< std::weak_ptr< ChunkBuilder >>>> vertexUse)
ChunkBuilder constructs a chun builder that can create individual chunks.
unsigned int numFaces() const
numFaces delivers the number of faces for the chunk
Handle to access faces of the mesh.
Definition: Handles.hpp:140


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06