Mesh

class pyrender.Mesh(primitives, name=None, weights=None, is_visible=True)[source]

Bases: object

A set of primitives to be rendered.

Parameters:
  • name (str) – The user-defined name of this object.
  • primitives (list of Primitive) – The primitives associated with this mesh.
  • weights ((k,) float) – Array of weights to be applied to the Morph Targets.
  • is_visible (bool) – If False, the mesh will not be rendered.

Attributes Summary

bounds The axis-aligned bounds of the mesh.
centroid The centroid of the mesh’s axis-aligned bounding box (AABB).
extents The lengths of the axes of the mesh’s AABB.
is_transparent If True, the mesh is partially-transparent.
is_visible Whether the mesh is visible.
name The user-defined name of this object.
primitives The primitives associated with this mesh.
scale The length of the diagonal of the mesh’s AABB.
weights Weights to be applied to morph targets.

Methods Summary

from_points(points[, colors, normals, …]) Create a Mesh from a set of points.
from_trimesh(mesh[, material, is_visible, …]) Create a Mesh from a Trimesh.

Attributes Documentation

bounds

The axis-aligned bounds of the mesh.

Type:(2,3) float
centroid

The centroid of the mesh’s axis-aligned bounding box (AABB).

Type:(3,) float
extents

The lengths of the axes of the mesh’s AABB.

Type:(3,) float
is_transparent

If True, the mesh is partially-transparent.

Type:bool
is_visible

Whether the mesh is visible.

Type:bool
name

The user-defined name of this object.

Type:str
primitives

The primitives associated with this mesh.

Type:list of Primitive
scale

The length of the diagonal of the mesh’s AABB.

Type:(3,) float
weights

Weights to be applied to morph targets.

Type:(k,) float

Methods Documentation

static from_points(points, colors=None, normals=None, is_visible=True, poses=None)[source]

Create a Mesh from a set of points.

Parameters:
  • points ((n,3) float) – The point positions.
  • colors ((n,3) or (n,4) float, optional) – RGB or RGBA colors for each point.
  • normals ((n,3) float, optionals) – The normal vectors for each point.
  • is_visible (bool) – If False, the points will not be rendered.
  • poses ((x,4,4)) – Array of 4x4 transformation matrices for instancing this object.
Returns:

mesh – The created mesh.

Return type:

Mesh

static from_trimesh(mesh, material=None, is_visible=True, poses=None, wireframe=False, smooth=True)[source]

Create a Mesh from a Trimesh.

Parameters:
  • mesh (Trimesh or list of them) – A triangular mesh or a list of meshes.
  • material (Material) – The material of the object. Overrides any mesh material. If not specified and the mesh has no material, a default material will be used.
  • is_visible (bool) – If False, the mesh will not be rendered.
  • poses ((n,4,4) float) – Array of 4x4 transformation matrices for instancing this object.
  • wireframe (bool) – If True, the mesh will be rendered as a wireframe object
  • smooth (bool) – If True, the mesh will be rendered with interpolated vertex normals. Otherwise, the mesh edges will stay sharp.
Returns:

mesh – The created mesh.

Return type:

Mesh