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
lvr2::BaseVector< float >
lvr2::ChunkBuilder::m_duplicateVertices
std::vector< VertexHandle > m_duplicateVertices
Definition: ChunkBuilder.hpp:138
lvr2::FaceHandle
Handle to access faces of the mesh.
Definition: Handles.hpp:140
lvr2::ChunkBuilderPtr
std::shared_ptr< ChunkBuilder > ChunkBuilderPtr
Definition: ChunkBuilder.hpp:48
lvr2::ChunkBuilder
Definition: ChunkBuilder.hpp:50
lvr2::ChunkBuilder::numVertices
unsigned int numVertices() const
numVertices amount of vertices ot the resulting mesh
Definition: ChunkBuilder.cpp:108
lvr2::ChunkBuilder::buildMesh
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
Definition: ChunkBuilder.cpp:113
lvr2::ChunkBuilder::~ChunkBuilder
~ChunkBuilder()
Definition: ChunkBuilder.cpp:49
HalfEdgeMesh.hpp
lvr2::ChunkBuilder::addDuplicateVertex
void addDuplicateVertex(const VertexHandle &index)
addDuplicateVertex marks a vertex as duplicate
Definition: ChunkBuilder.cpp:94
lvr2::VertexHandle
Handle to access vertices of the mesh.
Definition: Handles.hpp:146
lvr2::ChunkBuilder::ChunkBuilder
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.
Definition: ChunkBuilder.cpp:41
Model.hpp
lvr2::ChunkBuilder::addFace
void addFace(const FaceHandle &index)
assigns a face to the chunk this builder is generating
Definition: ChunkBuilder.cpp:51
lvr2::ChunkBuilder::m_numVertices
unsigned int m_numVertices
Definition: ChunkBuilder.hpp:135
lvr2::ChunkBuilder::m_originalMesh
std::shared_ptr< HalfEdgeMesh< BaseVector< float > > > m_originalMesh
Definition: ChunkBuilder.hpp:132
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::ChunkBuilder::numFaces
unsigned int numFaces() const
numFaces delivers the number of faces for the chunk
Definition: ChunkBuilder.cpp:103
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
lvr2::ChunkBuilder::m_vertexUse
std::shared_ptr< std::unordered_map< unsigned int, std::vector< std::weak_ptr< ChunkBuilder > > > > m_vertexUse
Definition: ChunkBuilder.hpp:146
lvr2::ChunkBuilder::m_faces
std::vector< FaceHandle > m_faces
Definition: ChunkBuilder.hpp:141
lvr2::HalfEdgeMesh
Half-edge data structure implementing the BaseMesh interface.
Definition: HalfEdgeMesh.hpp:70


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 Wed Mar 2 2022 00:37:23