Class: MeshIO

Utils. MeshIO

This class converts text from 3D file formats such as OBJ to a polygon soup mesh
and vice versa.


new MeshIO()

Methods


<static> readOBJ(input)

Converts text from an OBJ file to a polygon soup mesh.

Parameters:
Name Type Description
input string

The text from an OBJ file containing vertex positions
and indices.

Returns:

A polygon soup mesh containing vertex positions and indices.
Vertex positions and indices are keyed by "v" and "f" respectively.

Type
Object

<static> writeOBJ(polygonSoup)

Converts a polygon soup mesh to the OBJ file format.

Parameters:
Name Type Description
polygonSoup Object

A polygon soup mesh containing vertex positions
and indices. Texture coordinates and normals are optional.

Properties
Name Type Description
v Array.<module:LinearAlgebra.Vector>

The vertex positions of the polygon soup mesh.

vt Array.<module:LinearAlgebra.Vector>

The texture coordinates of the polygon soup mesh.

vn Array.<module:LinearAlgebra.Vector>

The normals of the polygon soup mesh.

f Array.<number>

The indices of the polygon soup mesh.

Returns:

Text containing vertex positions, texture coordinates, normals
and indices in the OBJ format.

Type
string