Previous:Disc Main Index Next:Polygon

#### Mesh

The `mesh` object can be used to efficiently store large numbers of triangles. Its syntax is:

MESH:
`
  mesh {
` MESH_TRIANGLE... [MESH_MODIFIER...] `}`
MESH_TRIANGLE:
`
  triangle {
` <Corner_1>`,` <Corner_2>`,` <Corner_3> [MESH_TEXTURE] `}` | `
  smooth_triangle {
`
  <Corner_1>`,` <Normal_1>`,`
  <Corner_2>`,` <Normal_2>`,`
  <Corner_3>`,` <Normal_3>
  [MESH_TEXTURE]
`
  }
`
MESH_TEXTURE:
`
  texture {
` TEXTURE_IDENTIFIER `}`
MESH_MODIFIER:
`
  hierarchy
` [ Boolean ] | OBJECT_MODIFIER

Any number of `triangle` and/or `smooth_triangle` statements can be used and each of those triangles can be individually textured by assigning a texture identifier to it. The texture has to be declared before the mesh is parsed. It is not possible to use texture definitions inside the triangle or smooth triangle statements. This is a restriction that is necessary for an efficient storage of the assigned textures. See "Triangle and Smooth Triangle" for more information on triangles.

The mesh's components are internally bounded by a bounding box hierarchy to speed up intersection testing. The bounding hierarchy can be turned off with the `hierarchy off` keyword. This should only be done if memory is short or the mesh consists of only a few triangles. The default is `hierarchy on`.

Copies of a mesh object refer to the same triangle data and thus consume very little memory. You can easily trace hundred copies of an 10000 triangle mesh without running out of memory (assuming the first mesh fits into memory).

The mesh object has two advantages over a union of triangles: it needs less memory and it is transformed faster. The memory requirements are reduced by efficiently storing the triangles vertices and normals. The parsing time for transformed meshes is reduced because only the mesh object has to be transformed and not every single triangle as it is necessary for unions.

The mesh object can currently only include triangle and smooth triangle components. That restriction may change, allowing polygonal components, at some point in the future.

Previous:Disc Main Index Next:Polygon