vispy.io.mesh module#

Reading and writing of data like images and meshes.

vispy.io.mesh.read_mesh(fname)#

Read mesh data from file.

Parameters:
fnamestr

File name to read. Format will be inferred from the filename. Currently only ‘.obj’ and ‘.obj.gz’ are supported.

Returns:
verticesarray

Vertices.

facesarray | None

Triangle face definitions.

normalsarray

Normals for the mesh.

texcoordsarray | None

Texture coordinates.

vispy.io.mesh.write_mesh(fname, vertices, faces, normals, texcoords, name='', format=None, overwrite=False, reshape_faces=True)#

Write mesh data to file.

Parameters:
fnamestr

Filename to write. Must end with “.obj” or “.gz”.

verticesarray

Vertices.

facesarray | None

Triangle face definitions.

normalsarray

Normals for the mesh.

texcoordsarray | None

Texture coordinates.

namestr

Name of the object.

formatstr

Currently only “obj” is supported.

overwritebool

If the file exists, overwrite it.

reshape_facesbool

Reshape the faces array to (Nf, 3). Set to False if you need to write a mesh with non triangular faces.