Class ChunkBuilder
Defined in File ChunkBuilder.hpp
Inheritance Relationships
Base Type
public std::enable_shared_from_this< ChunkBuilder >
Class Documentation
-
class ChunkBuilder : public std::enable_shared_from_this<ChunkBuilder>
Public Functions
ChunkBuilder constructs a chun builder that can create individual chunks.
- Parameters:
originalMesh – mesh that is being chunked
vertexUse – list of ChunkBuilders that for each vertex of the original mesh
-
~ChunkBuilder()
-
void 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:
index – index of face in the original model
-
void 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:
index – vertex index of diplicate vertex
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:
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
- Returns:
mesh of the newly created chunk
-
unsigned int 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
-
unsigned int 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