Go to the first, previous, next, last section, table of contents.

### MESH: rectangularly-connected mesh

The conventional suffix for a `MESH` file is ``.mesh'`.

The file syntax is

    [U][C][N][Z][4][u][v][n]MESH # Key word
    [Ndim]                 # Space dimension, present only if nMESH
    Nu Nv            # Mesh grid dimensions
                                 # Nu*Nv vertices, in format specified
                                 # by initial key word
    vertex(u=0,v=0)  vertex(1,0)  ... vertex(Nu-1,0)
    vertex(0,1) ...    vertex(Nu-1,1)
    ...
    vertex(0,Nv-1) ... vertex(Nu-1,Nv-1)

The key word is `[U][C][N][Z][4][u][v][n]MESH`. The optional prefix characters mean:

``U'`
  Each vertex includes a 3-component texture space parameter. The first two components are the usual `S` and `T` texture parameters for that vertex; the third should be specified as zero.
``C'`
  Each vertex (see Vertices above) includes a 4-component color.
``N'`
  Each vertex includes a surface normal vector.
``Z'`
  Of the 3 vertex position values, only the Z component is present; X and Y are omitted, and assumed to equal the mesh (u,v) coordinate so X ranges from 0 .. (Nu-1), Y from 0 .. (Nv-1) where Nu and Nv are the mesh dimensions -- see below.
``4'`
  Vertices are 4D, each consists of 4 floating values. `Z` and `4` cannot both be present.
``u'`
  The mesh is wrapped in the u-direction, so the (0,v)'th vertex is connected to the (Nu-1,v)'th for all v.
``v'`
  The mesh is wrapped in the v-direction, so the (u,0)'th vertex is connected to the (u,Nv-1)'th for all u. Thus a u-wrapped or v-wrapped mesh is topologically a cylinder, while a uv-wrapped mesh is a torus.
``n'`
  Specifies a mesh whose vertices live in a higher dimensional space. The dimension follows the "MESH" keyword. Each vertex then has Ndim components.

Note that the order of prefix characters is significant; a colored, u-wrapped mesh is a `CuMESH` not a `uCMESH`.

Following the mesh header are integers Nu and Nv, the dimensions of the mesh.

Then follow Nu*Nv vertices, each in the form given by the header. They appear in v-major order, i.e. if we name each vertex by (u,v) then the vertices appear in the order

    (0,0) (1,0) (2,0) (3,0) ...  (Nu-1,0)
    (0,1) (1,1) (2,1) (3,1) ...  (Nu-1,1)
    ...
    (0,Nv-1)		...  (Nu-1,Nv-1)

A `MESH BINARY` format is accepted; See section Binary format. The values of Nu and Nv are 32-bit integers; all other values are 32-bit floats.

Go to the first, previous, next, last section, table of contents.