com.md5importer.model
Class MD5Anim

java.lang.Object
  extended by com.md5importer.model.AbstractObservable
      extended by com.md5importer.model.MD5Anim
All Implemented Interfaces:
com.jme.util.export.Savable, IObservable, IMD5Anim, java.io.Serializable

public class MD5Anim
extends AbstractObservable
implements java.io.Serializable, IMD5Anim, com.jme.util.export.Savable

MD5Anim defines the concrete implementation of the MD5 animation data structure.

MD5Anim defines the hash code of an instance to be the hash code of the String name. Two instances of MD5Anim are considered as equal if both of them have the same name.

See Also:
Serialized Form

Constructor Summary
MD5Anim()
          Constructor of MD5Anim.
MD5Anim(java.lang.String name, java.lang.String[] IDs, IFrame[] frames, float framerate)
          Constructor of MD5Anim.
 
Method Summary
 IMD5Anim clone()
          Clone this animation.
 boolean equals(java.lang.Object object)
           
 float getAnimationTime()
          Retrieve the total time of a complete cycle of this animation.
 java.lang.Class<MD5Anim> getClassTag()
           
 int getFrameCount()
          Retrieve the total number of frames.
 java.lang.String[] getJointIDs()
          Retrieve the IDs of joints of this animation.
 java.lang.String getName()
          Retrieve the name of this animation.
 IFrame getNextFrame()
          Retrieve the next frame.
 int getNextIndex()
          Retrieve the next frame index number.
 float getNextTime()
          Retrieve the starting time of the next frame.
 float getPercentage()
          Get the complete percentage of the current cycle.
 IFrame getPreviousFrame()
          Retrieve the previous frame.
 int getPreviousIndex()
          Retrieve the previous frame index number.
 float getPreviousTime()
          Retrieve the starting time of the previous frame.
 float getTime()
          Retrieve the elapsed time since last frame change.
 int hashCode()
           
 void read(com.jme.util.export.JMEImporter im)
           
 void setIndices(int prev, int next, float time)
          Set the frame indices with given values.
 java.lang.String toString()
           
 void write(com.jme.util.export.JMEExporter ex)
           
 
Methods inherited from class com.md5importer.model.AbstractObservable
notifyUpdate, register, unregister
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.md5importer.interfaces.IObservable
notifyUpdate, register, unregister
 

Constructor Detail

MD5Anim

public MD5Anim()
Constructor of MD5Anim.


MD5Anim

public MD5Anim(java.lang.String name,
               java.lang.String[] IDs,
               IFrame[] frames,
               float framerate)
Constructor of MD5Anim.

Parameters:
name - The String name of this animation.
IDs - The String joint IDs.
frames - The array of key IFrame.
framerate - The Float frame rate.
Method Detail

setIndices

public void setIndices(int prev,
                       int next,
                       float time)
Description copied from interface: IMD5Anim
Set the frame indices with given values. The given values are automatically clamped between 0 and the last frame index.

Specified by:
setIndices in interface IMD5Anim
Parameters:
prev - The Integer previous frame index.
next - The Integer next frame index.
time - The The Float elapsed time since last set.

getAnimationTime

public float getAnimationTime()
Description copied from interface: IMD5Anim
Retrieve the total time of a complete cycle of this animation.

Specified by:
getAnimationTime in interface IMD5Anim
Returns:
The Float complete cycle time.

getFrameCount

public int getFrameCount()
Description copied from interface: IMD5Anim
Retrieve the total number of frames.

Specified by:
getFrameCount in interface IMD5Anim
Returns:
The Integer number of frames.

getPercentage

public float getPercentage()
Description copied from interface: IMD5Anim
Get the complete percentage of the current cycle.

Specified by:
getPercentage in interface IMD5Anim
Returns:
The Float percentage value.

getPreviousFrame

public IFrame getPreviousFrame()
Description copied from interface: IMD5Anim
Retrieve the previous frame.

Specified by:
getPreviousFrame in interface IMD5Anim
Returns:
The previous IFrame.

getPreviousIndex

public int getPreviousIndex()
Description copied from interface: IMD5Anim
Retrieve the previous frame index number.

Specified by:
getPreviousIndex in interface IMD5Anim
Returns:
The Integer index number.

getPreviousTime

public float getPreviousTime()
Description copied from interface: IMD5Anim
Retrieve the starting time of the previous frame.

Specified by:
getPreviousTime in interface IMD5Anim
Returns:
The Float starting time.

getNextFrame

public IFrame getNextFrame()
Description copied from interface: IMD5Anim
Retrieve the next frame.

Specified by:
getNextFrame in interface IMD5Anim
Returns:
The next IFrame.

getNextIndex

public int getNextIndex()
Description copied from interface: IMD5Anim
Retrieve the next frame index number.

Specified by:
getNextIndex in interface IMD5Anim
Returns:
The Integer index number.

getNextTime

public float getNextTime()
Description copied from interface: IMD5Anim
Retrieve the starting time of the next frame.

Specified by:
getNextTime in interface IMD5Anim
Returns:
The Float starting time.

getJointIDs

public java.lang.String[] getJointIDs()
Description copied from interface: IMD5Anim
Retrieve the IDs of joints of this animation.

Specified by:
getJointIDs in interface IMD5Anim
Returns:
The array of String IDs.

getName

public java.lang.String getName()
Description copied from interface: IMD5Anim
Retrieve the name of this animation.

Specified by:
getName in interface IMD5Anim
Returns:
The String name.

getTime

public float getTime()
Description copied from interface: IMD5Anim
Retrieve the elapsed time since last frame change.

Specified by:
getTime in interface IMD5Anim
Returns:
The Float time value.

getClassTag

public java.lang.Class<MD5Anim> getClassTag()
Specified by:
getClassTag in interface com.jme.util.export.Savable

write

public void write(com.jme.util.export.JMEExporter ex)
           throws java.io.IOException
Specified by:
write in interface com.jme.util.export.Savable
Throws:
java.io.IOException

read

public void read(com.jme.util.export.JMEImporter im)
          throws java.io.IOException
Specified by:
read in interface com.jme.util.export.Savable
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

clone

public IMD5Anim clone()
Description copied from interface: IMD5Anim
Clone this animation.

Specified by:
clone in interface IMD5Anim
Overrides:
clone in class java.lang.Object
Returns:
The cloned IMD5Anim instance.