The Mesh File Format Overview E-mail
Supplemental Object Documentation

1. Overview

The Meshes are ASCII (plain text) files that contain vertex data and are used to create physical objects not usually created by other formats.

2. Mesh Format Syntax

The header is the first section in the file and is as such...

 Mesh Version <single>

Mesh Version is a single that defines the current Mesh specification version, and should always read 1.0.

2.1 Parameters

This section contains specific parameters that make up the second section in the file.

 Meshes <integer>

Meshes is an integer that defines the number of meshes in the model.

2.2 Shaders

The third section in the file contains shaders. The shader is a set of instructions, which is used primarily to calculate material effects.

 Shader <string>

Shader is a string of the path and filename to the material to apply to the mesh.

2.3 Ordered Lists

The forth section in the file contains ordered lists. These lists contain data relevant to the type declared, and are represented by two separate arrays; one array holding the vertices, and another holding sets of three indices into an array which define a triangle.

Triangles

With this method, any arbitrary set of triangles sharing any arbitrary number of vertices can be stored, manipulated, and passed to the engine, without any intermediary processing.

Image

Triangles are first defined as an integer that defines the number of triangles that corresponds to the number of elements to follow in the list.

 Triangles <integer>
 Triangle  <index> <x> <y> <z>


1.
Index is the defined triangle.
2. X is the index of the first vertex for the triangle.
3. Y is the index of the second vertex for the triangle.
4.
Z is the index of the third vertex for the triangle.

Vertices

The vertex specification accepts data in multiple formats, but requires many executions to specify even simple geometry. Vertex data may also be placed into arrays that are stored and then may then be used to specify multiple triangles.

Image

Each vertex has its own texture coordinates. The UV texture coordinates for the upper-left corner of the texture are (0.0, 0.0). The UV texture coordinates for the lower-right corner are (1.0, 1.0).

Image

Vertices are first defined as an integer that defines the number of vertices that corresponds to the number of elements to follow in the list.

 Vertices <integer>
 Vertex   <index> <x> <y> <z> <u> <v>

1. Index is the defined vertex.
2. X is the x-axis origin of the vertex.
3. Y is the y-axis origin of the vertex.
4. Z is the z-axis origin of the vertex.
5. U is the texture map u coordinate for the vertex.
6. V is the texture map v coordinate for the vertex.

Game Basic processes the vertices first and renders the triangles afterwards if available.

3. Example

The following example is a set of instructions to render a single textured quad or two triangles with a total of only four necessary vertices. The file name can be saved with the extension *.mesh, and loaded directly into the running engine.

Mesh Version 1.0
 
Meshes 1
 
Mesh 1 {
 
    Shader "./material.shader"
 
    Triangles 2
 
    Triangle 1 1 2 3
    Triangle 2 1 3 4
 
    Vertices 4
 
    Vertex 1 -1.0 0.0  1.0 0.0 1.0
    Vertex 2 -1.0 0.0 -1.0 0.0 0.0
    Vertex 3  1.0 0.0 -1.0 1.0 0.0
    Vertex 4  1.0 0.0  1.0 1.0 1.0
 
}