com.model.md5
Class MD5Animation

java.lang.Object
  extended by com.model.md5.MD5Animation
All Implemented Interfaces:
com.jme.util.export.Savable, IMD5Animation, java.io.Serializable

public class MD5Animation
extends java.lang.Object
implements java.io.Serializable, IMD5Animation

MD5Animation is the final product of MD5 animation.

MD5Animation is added to a IMD5Controller for animating the skeletal IMD5Node.

MD5Animation provides the cloning functionality so that users can fast clone animations that may be used by multiple IMD5Node. The newly cloned MD5Animation is initialized and ready to be used.

See Also:
Serialized Form

Constructor Summary
MD5Animation()
          Constructor of MD5Animation.
MD5Animation(java.lang.String name, java.lang.String[] IDs, IFrame[] frames, float framerate)
          Constructor of MD5Animation.
 
Method Summary
 void addAnimation(IMD5Animation animation)
          Add a child MD5 animation.
 IMD5Animation 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 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.
 int hashCode()
           
 boolean isBackward()
          Check if this animation is being played backward.
 boolean isCyleComplete()
          Check if one cycle of this animation is complete, but the new one has not yet started.
 void read(com.jme.util.export.JMEImporter im)
           
 void removeAnimation(IMD5Animation animation)
          Remove the given animation.
 void reset()
          Reset the time and frame index information.
 java.lang.String toString()
           
 void update(float time, int repeat, float speed)
          Update the frame index based on given values.
 void write(com.jme.util.export.JMEExporter ex)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MD5Animation

public MD5Animation()
Constructor of MD5Animation.


MD5Animation

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

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

update

public void update(float time,
                   int repeat,
                   float speed)
Description copied from interface: IMD5Animation
Update the frame index based on given values.

Specified by:
update in interface IMD5Animation
Parameters:
time - The Float frame interpolation.
repeat - The Controller repeat type.
speed - The Float speed of the controller.

addAnimation

public void addAnimation(IMD5Animation animation)
Description copied from interface: IMD5Animation
Add a child MD5 animation.

Specified by:
addAnimation in interface IMD5Animation
Parameters:
animation - The child IMD5Animation to be added.

removeAnimation

public void removeAnimation(IMD5Animation animation)
Description copied from interface: IMD5Animation
Remove the given animation.

Specified by:
removeAnimation in interface IMD5Animation
Parameters:
animation - The child IMD5Animation to be removed.

getAnimationTime

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

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

getFrameCount

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

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

getPercentage

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

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

getPreviousFrame

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

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

getPreviousIndex

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

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

getPreviousTime

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

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

getNextFrame

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

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

getNextIndex

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

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

getNextTime

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

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

getJointIDs

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

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

getName

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

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

getClassTag

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

isBackward

public boolean isBackward()
Description copied from interface: IMD5Animation
Check if this animation is being played backward.

Specified by:
isBackward in interface IMD5Animation
Returns:
True if the animation is being played backward. False forward.

isCyleComplete

public boolean isCyleComplete()
Description copied from interface: IMD5Animation
Check if one cycle of this animation is complete, but the new one has not yet started.

Specified by:
isCyleComplete in interface IMD5Animation
Returns:
True if one cycle is complete. False otherwise.

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

reset

public void reset()
Description copied from interface: IMD5Animation
Reset the time and frame index information.

Specified by:
reset in interface IMD5Animation

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 IMD5Animation clone()
Description copied from interface: IMD5Animation
Clone this animation.

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