Last modified 9 months ago Last modified on 08/23/11 19:53:39

The WZM ASCII file format

Description

WZM is a ASCII text file used to specify model. Those model can have multiple meshes, with supports for both texture animation and "joint-less" bone animation ("bone heap" animation).

Specification

All the following directives must be present in a WZM file. Many directives also mark the start of a section. The directive must occur in the order specified below for the file to load properly. If a line in the file contains two consecutive slashes (""), then everything from there to the end of the line is considered to be a comment. This is commonly known as a "C++ style comment".

  • header section
  • texture directive
  • meshes directive
  • mesh directive
  • teamcolors directive
  • vertices directive
  • faces directive
  • vertexarray dirctive
  • TEXTUREARRAYS directive
  • TEXTUREARRAY directive
  • INDEXARRAY directive
  • FRAMES directive
  • CONNECTORS directive

header section

The first four characters of the file must be "WZM " followed by format version. Current version is 2. It is suggested to include some embedded comments as in exemple

WZM 2
//Name: safetyBelt.wzm
//Last modified: Fri, Apr 30, 2010 10:18:26 AM

texture directive

The texture directive give the file name of the texture, it must be png format. The file name allowed consist of character [A-Za-z] follow by possible characters [A-Za-z0-9_-] before the ".png" extension.

TEXTURE nonexisting.png

meshes directive

The meshes directive give the number of separate meshes contained within this model.

MESHES 1

mesh directive

The mesh directive the name of the first mesh. All the data below belongs to this first mesh until another MESH directive following a CONNECTORS list. What follows the directive itself shall be a unique string identifying the mesh, should no more than 20 letters long and only contain the characters [A-Za-z0-9_- ].

In version 1 the string following the directive had to be a sequentially increasing number starting from zero.

MESH name

teamcolors directive

The directive teamcolours specify if the team color option is allow for this mesh. A one for allowed, and a zero disallow. It must then have exactly eight texture arrays, and the mesh will be rendered with the texture array given by the player id of the player controlling the model.

TEAMCOLOURS 1

vertices directive

The vertices directive psecifies a number of unique vertices in the mesh. A vertex is unique if it shares position and texture coordinates with no other vertex.

VERTICES 4

faces directive

The faces directive specifies a number of triangular faces in this mesh.

FACES 2

vertexarray directive

The vertexarray directive mark the start of a section giving an array of floating point vertex positions. Each line has a tab or a space follow by three space delimited numbers, which are X, Y, and Z positions, respectively. Y is "up". The number of lines following this directive shall be equal to the number of unique vertices in the model, as given above.

FACES 2

texturearrays

The texturearray directive give a number of texture arrays contained within this mesh. If TEAMCOLOURS is 1, then this number must be 8.

TEXTUREARRAYS 1

texturearray directive

The texture directive give an array of texture coordinates for each vertex position. Each line start with a tab or a space follow by two space delimited floating point numbers, which are U and V positions into the texture, respectively. The number of lines following this directive shall be equal to the number of unique vertices in the mesh, as given above. The number following the directive is the index number of this texture array, counting from zero.

TEXTUREARRAY 0
	  0	0
	  0	0.5
	  0.5	0
	  0.5	0.5

indexarray directive

The indexarray directive is an array of triangle faces given by indexes into the current vertex array and the current texture coordinate array. Each line has a tab then three space delimited fixed point numbers, which are the vertices used in constructing a triangle. The number of lines is equal to the number of triangular faces in the mesh, as specified above.

INDEXARRAY
          0 1 2
          0 2 3

frames directive

The frames directive give the number of animation frame in the mesh. The directive start a section. Each following line begins with a tab or space followed by:

  • the time spent transforming into the next frame in floating point seconds.
  • An index into the texture array list for this frame - however, if team colours are enabled, it is ignored and it should be set to zero. X, Y, and Z translation of the mesh in world space. X, Y, and Z rotation of the mesh. There must be a FRAMES directive, even if the mesh has no animation - just set the number of frames to zero. Translation and rotation may be in floating point.
FRAMES 1
          0.0 0 0 0 0 0 0 0

connectors directive

The connector directive specifies the number of connection points on the mesh. This directive start a section.

  • The first string is the type of connector - allowed values are WEAPON, PROPULSION, and CHASSIS.
  • The three floating point numbers.
  • A list of world space X, Y, Z coordinates.
  • The following number specifies the initial rotation angle of the connector, followed in turn by rotation restrictions of the connected mesh, if applicable. If not applicable, they shall be zero. The number following the directive specifies the number of connectors in the list. There must be a CONNECTORS directive, even if the mesh has no connectors - just set the number following the directive to zero.

In version 1 the lines started with the three coordinates, and was followed only by a constant zero.

CONNECTORS 1
          WEAPON 13 21 2 0 0 0

Example Model

WZM 1
TEXTURE nonexisting.png
MESHES 3

MESH 0
TEAMCOLOURS 0
VERTICES 5
FACES 3
VERTEXARRAY
	-0.5  0.0  8.0
	 0.2  0.0  5.3
	 0.6 -1.5  0.0
	 0.2  5.2  1.0
	 5.0  1.2  0.3
TEXTUREARRAYS 4
TEXTUREARRAY 0
	 0	0
	 0	0.5
	 0.5	0
	 0.5	0.5
	 1	0.5
INDEXARRAY
	0 1 2
	0 2 3
	1 0 4
FRAMES 3
	0.0  3.2  0.0  6.1  0.0  0.0  0.0
	3.6  0.0  0.0  0.0   60 -120    0
	2.4  0.0  1.2  0.0    0  -15 12.6
CONNECTORS 0

See also

PIE format

Jorzi's new model format proposal