Chunk Class Reference

Class representing a sub-mesh containing local vertices and triangles. More...

Functions

 Chunk ()
 Default constructor. More...
 
 ~Chunk ()
 Default destructor. More...
 
void clear ()
 Clears all data. More...
 

Attributes

std::vector< float3 > vertices
 Vector of vertices. More...
 
std::vector< uint3 > triangles
 Vector of triangles/faces. More...
 
std::vector< float3 > normals
 Vector of normals. More...
 
std::vector< uchar3 > colors
 Vector of colors. More...
 
std::vector< float2 > uv
 UVs defines the 2D projection of each vertices onto the texture. More...
 
unsigned long long timestamp
 Timestamp of the latest update. More...
 
float3 barycenter
 3D centroid of the chunk. More...
 
bool has_been_updated
 Whether the point cloud chunk has been updated by an inner process. More...
 

Detailed Description

Class representing a sub-mesh containing 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 sl::Mesh.applyTexture()).

Constructor and Destructor

◆ Chunk()

Chunk ( )

Default constructor.

Creates an empty sl::Chunk.

◆ ~Chunk()

~Chunk ( )

Default destructor.

Functions

◆ clear()

void clear ( )

Clears all data.

Variables

◆ vertices

std::vector<float3> vertices

Vector of vertices.

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

◆ triangles

std::vector<uint3> triangles

Vector of triangles/faces.

Triangles are defined as a set of three vertices indexes {v1, v2, v3}.

◆ normals

std::vector<float3> normals

Vector of normals.

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

Note
A normal is defined for each vertex.

◆ colors

std::vector<uchar3> colors

Vector of colors.

Colors are defined by three components {b, g, r}.

Note
A color is 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] and start 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 sl::Mesh.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

Whether the point cloud chunk has been updated by an inner process.