Public Member Functions | Private Attributes | List of all members
lvr2::ChunkBuilder Class Reference

#include <ChunkBuilder.hpp>

Inheritance diagram for lvr2::ChunkBuilder:
Inheritance graph
[legend]

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< VertexHandlem_duplicateVertices
 
std::vector< FaceHandlem_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
 

Detailed Description

Definition at line 50 of file ChunkBuilder.hpp.

Constructor & Destructor Documentation

◆ ChunkBuilder()

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.

Parameters
originalMeshmesh that is being chunked
vertexUselist of ChunkBuilders that for each vertex of the original mesh

Definition at line 41 of file ChunkBuilder.cpp.

◆ ~ChunkBuilder()

lvr2::ChunkBuilder::~ChunkBuilder ( )

Definition at line 49 of file ChunkBuilder.cpp.

Member Function Documentation

◆ addDuplicateVertex()

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().

Parameters
indexvertex index of diplicate vertex

Definition at line 94 of file ChunkBuilder.cpp.

◆ addFace()

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.

Parameters
indexindex of face in the original model

Definition at line 51 of file ChunkBuilder.cpp.

◆ buildMesh()

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.

Parameters
attributedMeshoriginal mesh that contains attributes. represents same mesh as m_originalMesh
splitVerticesmap from new vertex indices to old vertex indices for all faces that have been cut
splitFacesmap from new face indices to old face indices for all faces that have been cut
Returns
mesh of the newly created chunk

Definition at line 113 of file ChunkBuilder.cpp.

◆ numFaces()

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.

Returns
number of faces added to this builder

Definition at line 103 of file ChunkBuilder.cpp.

◆ numVertices()

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.

Returns
number of vertices added to this builder

Definition at line 108 of file ChunkBuilder.cpp.

Member Data Documentation

◆ m_duplicateVertices

std::vector<VertexHandle> lvr2::ChunkBuilder::m_duplicateVertices
private

Definition at line 138 of file ChunkBuilder.hpp.

◆ m_faces

std::vector<FaceHandle> lvr2::ChunkBuilder::m_faces
private

Definition at line 141 of file ChunkBuilder.hpp.

◆ m_numVertices

unsigned int lvr2::ChunkBuilder::m_numVertices = 0
private

Definition at line 135 of file ChunkBuilder.hpp.

◆ m_originalMesh

std::shared_ptr<HalfEdgeMesh<BaseVector<float> > > lvr2::ChunkBuilder::m_originalMesh = nullptr
private

Definition at line 132 of file ChunkBuilder.hpp.

◆ m_vertexUse

std::shared_ptr<std::unordered_map<unsigned int, std::vector<std::weak_ptr<ChunkBuilder> > > > lvr2::ChunkBuilder::m_vertexUse
private

Definition at line 146 of file ChunkBuilder.hpp.


The documentation for this class was generated from the following files:


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:27