Reference:Mesh2

From POV-Wiki
Jump to navigation Jump to search

The new mesh syntax is designed for use in conversion from other file formats.

MESH2 :
  mesh2{
    VECTORS...
    LISTS...   |
    INDICES... |
    MESH_MODIFIERS
    }
VECTORS :
  vertex_vectors {
  number_of_vertices,
  <vertex1>, <vertex2>, ...
  }|
  normal_vectors {
    number_of_normals,
    <normal1>, <normal2>, ...
    }|
  uv_vectors {
    number_of_uv_vectors,
    <uv_vect1>, <uv_vect2>, ...
    }
LISTS :
  texture_list {
    number_of_textures,
    texture { Texture1 },
    texture { Texture2 }, ...
    }|
INDICES :
  face_indices {
    number_of_faces,
      <index_a, index_b, index_c> [,texture_index [,
    texture_index, texture_index]],
      <index_d, index_e, index_f> [,texture_index [,
      texture_index, texture_index]],
      ...
      }|
  normal_indices {
    number_of_faces,
      <index_a, index_b, index_c>,
      <index_d, index_e, index_f>,
      ...
      }|
  uv_indices {
    number_of_faces,
      <index_a, index_b, index_c>,
      <index_d, index_e, index_f>,
      ...
      }
MESH_MODIFIER :
  inside_vector <direction> | OBJECT_MODIFIERS

Best practices dictate that the mesh2 object definition SHOULD be specified in the following order:

  • VECTORS
  • LISTS
  • INDICES

However, the actual implementation also allows the texture_list to be placed BEFORE vertex_vectors.

The normal_vectors, uv_vectors, and texture_list sections are optional. If the number of normals equals the number of vertices then the normal_indices section is optional and the indexes from the face_indices section are used instead. Likewise for the uv_indices section.

Note: The texture_list section is optional only if face_indices doesn't contain any texture index values.

For example:

face_indices {
  number_of_faces,
  <index_a, index_b, index_c>,
  <index_d, index_e, index_f>,
  ...
  }

Note: The numbers of uv_indices must equal number of faces.

The indexes are zero based, so the first item in each list has an index of zero.

Smooth and Flat triangles in the same mesh

You can specify both flat and smooth triangles in the same mesh. To do this, specify the smooth triangles first in the face_indices section, followed by the flat triangles. Then, specify normal indices (in the normal_indices section) for only the smooth triangles. Any remaining triangles that do not have normal indices associated with them will be assumed to be flat triangles.

Mesh Triangle Textures

To specify a texture for an individual mesh triangle, specify a single integer texture index following the face-index vector for that triangle.

To specify three textures for vertex-texture interpolation, specify three integer texture indices (separated by commas) following the face-index vector for that triangle.

Vertex-texture interpolation and textures for an individual triangle can be mixed in the same mesh.