Chunk Class Reference

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

Functions

np.array[float] vertices (self)
 NumPy array of vertices. More...
 
np.array[int] triangles (self)
 NumPy array of triangles/faces. More...
 
np.array[float] normals (self)
 NumPy array of normals. More...
 
np.array[int] colors (self)
 NumPy array of colors. More...
 
np.array[float] uv (self)
 UVs defines the 2D projection of each vertices onto the texture. More...
 
int timestamp (self)
 Timestamp of the latest update.
 
np.array[float] barycenter (self)
 3D centroid of the chunk.
 
bool has_been_updated (self)
 Whether the chunk has been updated by an inner process.
 
None clear (self)
 Clears all data.
 

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

Functions

◆ vertices()

np.array[float] vertices (   self)

NumPy array of vertices.

Vertices are defined by a 3D point [x, y, z].

◆ triangles()

np.array[int] triangles (   self)

NumPy array of triangles/faces.

Triangle defined as a set of three vertices indexes [v1, v2, v3].

◆ normals()

np.array[float] normals (   self)

NumPy array of normals.

Normals are defined by three components [nx, ny, nz].

Note
A normal is defined for each vertex.

◆ colors()

np.array[int] colors (   self)

NumPy array of colors.

Colors are defined by three components [r, g, b].

Note
A color is defined for each vertex.

◆ uv()

np.array[float] uv (   self)

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