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), cyberthug.run.iff (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:
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
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
int32 flags; // shading, etc.
int32 color; // material color (8 unused, 8 red, 8 green, 8 blue)
char name~[256~]; // texture filename
Array of faces:
int16 vertex0Index; // index into vertex array above
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:
- Make one big animation, and keep track of which sub-section to play out of the animation in your engine (not recommended) or
- 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:
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.