#include <ChunkBuilder.hpp>
Public Member Functions | |
void | addDuplicateVertex (const VertexHandle &index) |
addDuplicateVertex marks a vertex as duplicate More... | |
void | addFace (const FaceHandle &index) |
assigns a face to the chunk this builder is generating More... | |
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 More... | |
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. More... | |
unsigned int | numFaces () const |
numFaces delivers the number of faces for the chunk More... | |
unsigned int | numVertices () const |
numVertices amount of vertices ot the resulting mesh More... | |
~ChunkBuilder () | |
Private Attributes | |
std::vector< VertexHandle > | m_duplicateVertices |
std::vector< FaceHandle > | m_faces |
unsigned int | m_numVertices = 0 |
std::shared_ptr< HalfEdgeMesh< BaseVector< float > > > | m_originalMesh = nullptr |
std::shared_ptr< std::unordered_map< unsigned int, std::vector< std::weak_ptr< ChunkBuilder > > > > | m_vertexUse |
Definition at line 50 of file ChunkBuilder.hpp.
lvr2::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.
originalMesh | mesh that is being chunked |
vertexUse | list of ChunkBuilders that for each vertex of the original mesh |
Definition at line 41 of file ChunkBuilder.cpp.
lvr2::ChunkBuilder::~ChunkBuilder | ( | ) |
Definition at line 49 of file ChunkBuilder.cpp.
void lvr2::ChunkBuilder::addDuplicateVertex | ( | const VertexHandle & | index | ) |
addDuplicateVertex marks a vertex as duplicate
Duplicate vertices will be added to the beginning of the Vertex array of the chunk mesh when calling buildMesh().
index | vertex index of diplicate vertex |
Definition at line 94 of file ChunkBuilder.cpp.
void lvr2::ChunkBuilder::addFace | ( | const FaceHandle & | index | ) |
assigns a face to the chunk this builder is generating
This adds a face to the face list of this builder. It is used to create a chunk when calling buildMesh.
index | index of face in the original model |
Definition at line 51 of file ChunkBuilder.cpp.
MeshBufferPtr lvr2::ChunkBuilder::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
By calling buildMesh(), the mesh of a new chunk is being created. Before building a chunk, faces need to be added to this builder using the method addFace(index). The vertex buffer of resulting mesh holds the vertices that got duplicated during the chunking process at the first fields of the buffer followed by the normal vertices. If the number of added faces is 0 this function will return an mesh buffer holding no vertices or faces.
attributedMesh | original mesh that contains attributes. represents same mesh as m_originalMesh |
splitVertices | map from new vertex indices to old vertex indices for all faces that have been cut |
splitFaces | map from new face indices to old face indices for all faces that have been cut |
Definition at line 113 of file ChunkBuilder.cpp.
unsigned int lvr2::ChunkBuilder::numFaces | ( | ) | const |
numFaces delivers the number of faces for the chunk
This delivers the amount of faces currently added to a ChunkBuilder instance. This functionality is especially useful for checking whether or not a generatec mesh would be empty before calling buildMesh.
Definition at line 103 of file ChunkBuilder.cpp.
unsigned int lvr2::ChunkBuilder::numVertices | ( | ) | const |
numVertices amount of vertices ot the resulting mesh
This delivers the amount of vertices that the resulting mesh would have when calling buildMesh.
Definition at line 108 of file ChunkBuilder.cpp.
|
private |
Definition at line 138 of file ChunkBuilder.hpp.
|
private |
Definition at line 141 of file ChunkBuilder.hpp.
|
private |
Definition at line 135 of file ChunkBuilder.hpp.
|
private |
Definition at line 132 of file ChunkBuilder.hpp.
|
private |
Definition at line 146 of file ChunkBuilder.hpp.