com.jme.animation
Class BoneTransform

java.lang.Object
  extended by com.jme.animation.BoneTransform
All Implemented Interfaces:
Savable, java.io.Serializable

public class BoneTransform
extends java.lang.Object
implements java.io.Serializable, Savable

BoneTransform contains a Bone/Transform array pairing. This pairing defines the bone that will be transformed (translate, rotate), and the transformations for a given frame. The bone is updated during a call to the update method that defines two keyframes and the interpolation value between them.

See Also:
Serialized Form

Constructor Summary
BoneTransform()
          Default constructor creates a new BoneTransform with no data set.
BoneTransform(Bone bone, int frames)
          Constructor defines the bone that will be transformed as well as how many transform keyframes that exist.
BoneTransform(Bone bone, Matrix4f[] transforms)
          Constructor defines the bone and the list of transforms to use.
 
Method Summary
 boolean findBone(Bone b)
           
 Bone getBone()
          returns the bone that this BoneTransform is responsible for updating.
 java.lang.String getBoneId()
           
 java.lang.Class getClassTag()
           
 Quaternion[] getRotations()
           
 Vector3f[] getTranslations()
           
 void read(JMEImporter e)
           
 void setBone(Bone b)
          defines the bone that the controller will be affecting.
 void setBoneId(java.lang.String boneId)
           
 void setCurrentFrame(int frame)
          setCurrentFrame will set the current frame from the bone.
 void setCurrentFrame(int frame, Bone source, Spatial destination, float diffModifier, AnimationProperties props)
           
 void setCurrentFrame(int frame, float blend)
           
 void setCurrentFrame(int frame, float blend, Bone source, Spatial destination, float diffModifier, AnimationProperties props)
          setCurrentFrame will set the current frame from the bone.
 void setRotation(int index, Quaternion rotation)
          setRotation sets a rotation for a given frame.
 void setRotations(Quaternion[] rotations)
          sets the rotations array for the keyframes.
 void setTransform(int index, Matrix4f transform)
          setTransforms sets a transform for a given frame.
 void setTransforms(Matrix4f[] transforms)
          sets the transforms array for the keyframes.
 void setTranslation(int index, Vector3f translation)
          setTranslation sets a translation for a given frame.
 void setTranslations(Vector3f[] translations)
          sets the translations array for the keyframes.
 void update(int prevFrame, int currentFrame, int interpType, float time)
          update sets the transform of the bone to a given interpolation between two given frames.
 void update(int prevFrame, int currentFrame, int interpType, float time, float blend)
           
 void write(JMEExporter e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoneTransform

public BoneTransform()
Default constructor creates a new BoneTransform with no data set.


BoneTransform

public BoneTransform(Bone bone,
                     int frames)
Constructor defines the bone that will be transformed as well as how many transform keyframes that exist. These keyframes are not set until setXXXX is called.

Parameters:
bone - the bone to transform.
frames - the number of keyframes for this animation.

BoneTransform

public BoneTransform(Bone bone,
                     Matrix4f[] transforms)
Constructor defines the bone and the list of transforms to use. This constructor builds a complete BoneTransform ready for use.

Parameters:
bone - the bone to transform.
transforms - the transforms to use.
Method Detail

setCurrentFrame

public void setCurrentFrame(int frame)
setCurrentFrame will set the current frame from the bone. The frame supplied will define how to transform the bone. It is the responsibility of the caller to insure the frame supplied is valid.

Parameters:
frame - the frame to set the bone's transform to.

setCurrentFrame

public void setCurrentFrame(int frame,
                            Bone source,
                            Spatial destination,
                            float diffModifier,
                            AnimationProperties props)

setCurrentFrame

public void setCurrentFrame(int frame,
                            float blend)

setCurrentFrame

public void setCurrentFrame(int frame,
                            float blend,
                            Bone source,
                            Spatial destination,
                            float diffModifier,
                            AnimationProperties props)
setCurrentFrame will set the current frame from the bone. The frame supplied will define how to transform the bone. It is the responsibility of the caller to insure the frame supplied is valid.

Parameters:
frame - the frame to set the bone's transform to.

update

public void update(int prevFrame,
                   int currentFrame,
                   int interpType,
                   float time)
update sets the transform of the bone to a given interpolation between two given frames.

Parameters:
prevFrame - the initial frame.
currentFrame - the goal frame.
interpType - the type of interpolation
time - the time between frames

update

public void update(int prevFrame,
                   int currentFrame,
                   int interpType,
                   float time,
                   float blend)

setTransform

public void setTransform(int index,
                         Matrix4f transform)
setTransforms sets a transform for a given frame. It is the responsibility of the caller to insure that the index is valid.

Parameters:
index - the index of the transform to set.
transform - the transform to set at the index.

setRotation

public void setRotation(int index,
                        Quaternion rotation)
setRotation sets a rotation for a given frame. It is the responsibility of the caller to insure that the index is valid.

Parameters:
index - the index of the rotation to set.
rotation - the rotation to set at the index.

setTranslation

public void setTranslation(int index,
                           Vector3f translation)
setTranslation sets a translation for a given frame. It is the responsibility of the caller to insure that the index is valid.

Parameters:
index - the index of the translation to set.
translation - the translation to set at the index.

setRotations

public void setRotations(Quaternion[] rotations)
sets the rotations array for the keyframes. This array should be the same size as the times array and the types array. This is left to the user to insure, if they are not the same, an ArrayIndexOutOfBounds exception will be thrown during update.

Parameters:
rotations - the rotations to set.

setTranslations

public void setTranslations(Vector3f[] translations)
sets the translations array for the keyframes. This array should be the same size as the times array and the types array. This is left to the user to insure, if they are not the same, an ArrayIndexOutOfBounds exception will be thrown during update.

Parameters:
translations - the translations to set.

setTransforms

public void setTransforms(Matrix4f[] transforms)
sets the transforms array for the keyframes. This array should be the same size as the times array and the types array. This is left to the user to insure, if they are not the same, an ArrayIndexOutOfBounds exception will be thrown during update.

Parameters:
transforms - the transforms to set.

setBone

public void setBone(Bone b)
defines the bone that the controller will be affecting.

Parameters:
b - the bone that will be controlled.

getBone

public Bone getBone()
returns the bone that this BoneTransform is responsible for updating.

Returns:
the bone this BoneTransform is responsible for updating.

getRotations

public Quaternion[] getRotations()
Returns:
the rotations array this BoneTransform is reponsible for applying to the bone.

getTranslations

public Vector3f[] getTranslations()
Returns:
the translations array this BoneTransform is reponsible for applying to the bone.

getBoneId

public java.lang.String getBoneId()

setBoneId

public void setBoneId(java.lang.String boneId)

findBone

public boolean findBone(Bone b)

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getClassTag

public java.lang.Class getClassTag()
Specified by:
getClassTag in interface Savable