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< float3 > | vertices |
std::vector< uint3 > | triangles |
std::vector< float3 > | normals |
std::vector< float2 > | uv |
unsigned long long | timestamp |
float3 | barycenter |
bool | has_been_updated |
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.
void clear | ( | ) |
Clears all chunk data.
std::vector<float3> vertices |
Vertices are defined by a 3D point {x,y,z}.
std::vector<uint3> triangles |
Vector of triangles, defined as a set of three vertices {v1, v2, v3}.
std::vector<float3> normals |
Normals are defined by three components, {nx, ny, nz}. Normals are defined for each vertex.
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.
unsigned long long timestamp |
Timestamp of the latest update.
float3 barycenter |
3D centroid of the chunk.
bool has_been_updated |
True if the chunk has been updated by an inner process.