WF Format


WF format is a simple ASCII format for polygonal data, either 2D or 3D. It is organized in three sections, which are separated by a single blank line:

The vertex list section is mandatory, but the edge and face list are optional. A BNF describing the structure of the file follows.

<id> ::= <integer>
<x> ::= <float>
<y> ::= <float>
<z> ::= <float>
<uv coords> ::= <float> <float>
<RGB color> ::= <float> <float> <float>

<vertex> ::= <x> <y> [<z> [<id> [<RGB color> [<uv coords>]]]] <newline>
<vertices> ::= <vertex> <vertices> | <empty>

<edge> ::= <vertex id> <vertex id> <newline>
<edges> ::= <edge> <edges> | <empty>

<face> ::= <vertex id> <vertex id> <vertex id> <newline>
<faces> ::= <face> <faces> | <empty>

<file> ::= <vertices> <newline> [<edges>] <newline> [<faces>] <newline>

Each vertex of the mesh is composed by a position in 2D or 3D space, an identifier, a color tuple given in the RGB system, and its texture coordinates. The 2D position and the RGB color are normalized. Each edge is composed simply by the identifiers of its two endpoints, and a face by the identifier of its three vertices. Lines preceded by a '#' are ignored, and can be used for comments or special tags.

The sections are optional, as well as many of the vertex components, so that common place files such as a simple list of x and y coordinates is a valid wf file.

Special Tags

Morphos uses several special tags as the first line of a wf file. All specifications are currently saved as wf files, allowing them to be loaded and viewed by Play3D. They also can be used as graphical objects, provided the special tag is changed by hand.

Some of the special tags are: