pygfx.objects.InstancedMesh

class pygfx.objects.InstancedMesh(geometry, material, count, **kwargs)

Bases: Mesh

Display a mesh multiple times using instances.

An instanced mesh with a matrix for each instance.

Parameters:
  • geometry (Geometry) – The mesh’s geometry data.

  • material (Material) – The material with which to render the mesh.

  • count (int) – The number of instances to create.

  • kwargs (Any) – Additional kwargs get forwarded to the base class.

set_matrix_at(index: int, matrix)

set the matrix for the instance at the given index.

get_matrix_at(index: int)

get the matrix for the instance at the given index.

Examples

Instancing

Instancing

Look At (Instanced Mesh)

Look At (Instanced Mesh)