vispy.visuals.mesh module

A MeshVisual Visual that uses the new shader Function.

class vispy.visuals.mesh.MeshVisual(vertices=None, faces=None, vertex_colors=None, face_colors=None, color=(0.5, 0.5, 1, 1), vertex_values=None, meshdata=None, shading=None, mode='triangles', **kwargs)[source]

Bases: vispy.visuals.visual.Visual

Mesh visual

Parameters
verticesarray-like | None

The vertices.

facesarray-like | None

The faces.

vertex_colorsarray-like | None

Colors to use for each vertex.

face_colorsarray-like | None

Colors to use for each face.

colorinstance of Color

The color to use.

vertex_valuesarray-like | None

The values to use for each vertex (for colormapping).

meshdatainstance of MeshData | None

The meshdata.

shadingstr | None

Shading to use.

modestr

The drawing mode.

**kwargsdict

Keyword arguments to pass to Visual.

property ambient_light_color

The ambient light color

property clim
property cmap
property color

The uniform color for this mesh

draw(*args, **kwds)[source]
property light_dir

The light direction

property mesh_data

The mesh data

mesh_data_changed()[source]
property mode

The triangle mode used to draw this mesh.

Options are:

  • ‘triangles’: Draw one triangle for every three vertices (eg, [1,2,3], [4,5,6], [7,8,9)

  • ‘triangle_strip’: Draw one strip for every vertex excluding the first two (eg, [1,2,3], [2,3,4], [3,4,5])

  • ‘triangle_fan’: Draw each triangle from the first vertex and the last two vertices (eg, [1,2,3], [1,3,4], [1,4,5])

set_data(vertices=None, faces=None, vertex_colors=None, face_colors=None, color=None, vertex_values=None, meshdata=None)[source]

Set the mesh data

Parameters
verticesarray-like | None

The vertices.

facesarray-like | None

The faces.

vertex_colorsarray-like | None

Colors to use for each vertex.

face_colorsarray-like | None

Colors to use for each face.

colorinstance of Color

The color to use.

vertex_valuesarray-like | None

Values for each vertex.

meshdatainstance of MeshData | None

The meshdata.

property shading

The shading method used.

property shininess

The shininess