md3.md3model
Class AnimationCfg

java.lang.Object
  |
  +--md3.md3model.AnimationCfg

public class AnimationCfg
extends java.lang.Object

A class providing functionality to access the animation data found in the animation.cfg files that come with (some) animated models.

Author:
Erwin Vervaet (erwin@cs.kuleuven.ac.be)

Field Summary
static int ALL
          The animation is applicable to all submodels.
static int BOTH
          The animation is applicable to BOTH the LEGS and TORSO submodels of a composed model.
 java.lang.String footsteps
          Type of footstep sounds associated with animations (e.g.
 Vec3 headOffset
          Head offset, none by default.
static int LEGS
          The animation is only applicable to the LEGS submodel of a composed model.
 char sex
          Sex of animated model: 'm' for male, 'f' for female, 'n' for none.
static int TORSO
          The animation is only applicable to the TORSO submodel of a composed model.
 
Constructor Summary
protected AnimationCfg()
          Create an empty animation data resource.
protected AnimationCfg(java.io.InputStream in)
          Constructor that loads animation.cfg data coming from the specified input stream into the internal data stuctures.
protected AnimationCfg(java.lang.String file)
          Constructor that loads an animation.cfg file into the internal data stuctures.
 
Method Summary
 java.util.Iterator animationNames()
          Return an Iterator listing the names of all known animations.
 MD3Animation getAnimation(java.lang.String name)
          Look up the animation data for the animation with the specified name.
 void putAnimation(MD3Animation anim)
          Add the specified animation to the list of known animations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEGS

public static final int LEGS

The animation is only applicable to the LEGS submodel of a composed model. This submodel is normally the top level model, loaded from a file lower.md3.


TORSO

public static final int TORSO

The animation is only applicable to the TORSO submodel of a composed model. The TORSO submodel is normally loaded from a file upper.md3.


BOTH

public static final int BOTH

The animation is applicable to BOTH the LEGS and TORSO submodels of a composed model.


ALL

public static final int ALL

The animation is applicable to all submodels.


sex

public char sex

Sex of animated model: 'm' for male, 'f' for female, 'n' for none.


headOffset

public Vec3 headOffset

Head offset, none by default. This is the offset of the head model in the HUD in X,Y,Z coordinates.


footsteps

public java.lang.String footsteps

Type of footstep sounds associated with animations (e.g. "mech"). Defaults to "unspecified".

Constructor Detail

AnimationCfg

protected AnimationCfg()

Create an empty animation data resource. Use this when creating and managing your own animations.


AnimationCfg

protected AnimationCfg(java.lang.String file)
                throws java.io.IOException

Constructor that loads an animation.cfg file into the internal data stuctures. The read information can later be consulted using the animationNames() and getAnimation() methods.

Parameters:
file - The file to open.

AnimationCfg

protected AnimationCfg(java.io.InputStream in)
                throws java.io.IOException

Constructor that loads animation.cfg data coming from the specified input stream into the internal data stuctures. The read information can later be consulted using the animationNames() and getAnimation() methods.

Parameters:
in - The stream to read data from.
Method Detail

animationNames

public java.util.Iterator animationNames()

Return an Iterator listing the names of all known animations.


getAnimation

public MD3Animation getAnimation(java.lang.String name)

Look up the animation data for the animation with the specified name.

Parameters:
name - Name of the animation.
Returns:
The animation data associated with the name or null if no data was found.

putAnimation

public void putAnimation(MD3Animation anim)

Add the specified animation to the list of known animations.