You are here: Foswiki>WorldFoundry Web>ModelIFFFormat (09 Oct 2002, MrLin;)Edit Attach

Model Exporter IFF output

For examples of these files, see wflevels/superhero/cyberthug.mesh.iff (the MODL mesh), cyberthug.idle.iff (the one-frame ANIM animation), (the 10-frame ANIM running animation), cyber.ali (which binds the mesh file and the animation files together, and tells the engine which animation to play for each hard-coded animation event that the engine generates).

The outer chunk name for a World Foundry Model is 'MODL', contained within are:

Chunk Name
String describing what tool created this model
String describing intended target of this model
String containing original name of model
Global model coordinates (0,0,0 if respect position turned off in exporter)
Array of vertices
 Struct Vertex
 fixed32 u;   // U coordinate of texture map
 fixed32 v;   // V coordinate of texture map
 int32 color;   // Vertex color
 fixed32 x;   // Vertex X position
 fixed32 y;   // Vertex Y position
 fixed32 z;   // Vertex Z position
Array of materials
 Struct Material
   int32   flags;   // shading, etc.
   int32   color;   // material color (8 unused, 8 red, 8 green, 8 blue)
   char   name~[256~];   // texture filename
Array of faces:
 Struct Face
   int16   vertex0Index;      // index into vertex array above
   int16   vertex1Index;
   int16   vertex2Index;
   int16   materialIndex;   // index into materials array above

For efficiency, if a model is animated, there are only new vertex chunks (since the rest does not change while animating). There are two ways to handle multiple animations on a single model:
  1. Make one big animation, and keep track of which sub-section to play out of the animation in your engine (not recommended) or
  2. Export a single model file, and a separate animation file per animation desired. If the files are exported to text iff they can be concatenated to form the final model/animation file. See AnimationHandlingInWorldFoundryEngine for instructions as to exactly how to concatenate several animation files into one final model/animation file.

If a model is animated, there is also a 'ANIM' chunk, it contains:

Chunk Name
Animation Header:
   Struct ~AnimationHeader
      int16   frameCount;   // # of frames in this animation
Same as above, but vertex positions are not absolute, instead being DELTA positions from the original vertex positions.
Topic revision: r1 - 09 Oct 2002, MrLin;
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback