Chunk Class Reference

Represents a sub-mesh, it contains local vertices and triangles. More...

Functions

 Chunk ()
 Default constructor which creates an empty Chunk. More...
 
 ~Chunk ()
 Chunk destructor. More...
 
void clear ()
 Clears all chunk data. More...
 

Attributes

std::vector< float3vertices
 
std::vector< uint3triangles
 
std::vector< float3normals
 
std::vector< float2uv
 
unsigned long long timestamp
 
float3 barycenter
 
bool has_been_updated
 

Detailed Description

Represents a sub-mesh, it contains local vertices and triangles.

Vertices and normals have the same size and are linked by id stored in triangles.

Note
uv contains data only if your mesh have textures (by loading it or after calling applyTexture).

Constructor and Destructor

◆ Chunk()

Chunk ( )

Default constructor which creates an empty Chunk.

◆ ~Chunk()

~Chunk ( )

Chunk destructor.

Functions

◆ clear()

void clear ( )

Clears all chunk data.

Variables

◆ vertices

std::vector<float3> vertices

Vertices are defined by a 3D point {x,y,z}.

◆ triangles

std::vector<uint3> triangles

Vector of triangles, defined as a set of three vertices {v1, v2, v3}.

◆ normals

std::vector<float3> normals

Normals are defined by three components, {nx, ny, nz}. Normals are defined for each vertex.

◆ uv

std::vector<float2> uv

UVs defines the 2D projection of each vertices onto the Texture.
Values are normalized [0;1], starting from the bottom left corner of the texture (as requested by opengl).
In order to display a textured mesh you need to bind the Texture and then draw each triangle by picking its uv values.

Note
Contains data only if your mesh has textures (by loading it or calling applyTexture).

◆ timestamp

unsigned long long timestamp

Timestamp of the latest update.

◆ barycenter

float3 barycenter

3D centroid of the chunk.

◆ has_been_updated

bool has_been_updated

True if the chunk has been updated by an inner process.