org.jagatoo.loaders.models.collada.datastructs.animation
Class Bone

java.lang.Object
  extended by org.jagatoo.loaders.models.collada.datastructs.animation.Bone

public class Bone
extends java.lang.Object

A Bone (of a Skeleton)


Field Summary
 org.openmali.vecmath2.Matrix4f bindMatrix
          The bind matrix
 org.openmali.vecmath2.Matrix4f invBindMatrix
          The inverse bind matrix
 org.openmali.vecmath2.Quaternion4f relativeRotation
          The rotation of this bone
 org.openmali.vecmath2.Tuple3f relativeScaling
          The scaling of this bone, along the three axis : X, Y, and Z.
 java.util.ArrayList<KeyFrameQuat4f> rotKeyFrames
          Temporal key frames for the bone.
 java.util.ArrayList<KeyFrameTuple3f> scaleKeyFrames
          Temporal key frames for the bone.
 
Constructor Summary
Bone(java.lang.String sid, java.lang.String name, org.openmali.vecmath2.Matrix4f matrix, org.openmali.vecmath2.Quaternion4f bindRotation)
          Create a new Bone
 
Method Summary
 void addChild(Bone bone)
          Adds a child bone.
 org.openmali.vecmath2.Quaternion4f getAbsoluteRotation()
          Get the absolute rotation of this bone.
 org.openmali.vecmath2.Tuple3f getAbsoluteScaling()
           
 org.openmali.vecmath2.Matrix4f getAbsoluteTransformation()
           
 org.openmali.vecmath2.Vector3f getAbsoluteTranslation()
          Get the absolute translation of this bone.
 org.openmali.vecmath2.Quaternion4f getBindRotation()
           
 Bone getChild(int i)
          Gets a bone by index.
 float getLength()
           
 java.lang.String getName()
           
 java.lang.String getSourceId()
           
 boolean hasKeyFrames()
           
 int numChildren()
           
 void removeChild(Bone bone)
          Removes a child bone.
 int selectCurrentRotFrame(long currentTime)
          Selects the current translation key frame, based on the current time
 int selectCurrentScaleFrame(long currentTime)
          Selects the current scaling key frame, based on the current time
 void setBindRotation(org.openmali.vecmath2.Quaternion4f quat)
          Sets the bindRotation.
 void setLength(float length)
          Sets the length.
 void setNoRelativeMovement()
          Completes the relativeTranslation and relativeRotation all with 0.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bindMatrix

public final org.openmali.vecmath2.Matrix4f bindMatrix
The bind matrix


invBindMatrix

public final org.openmali.vecmath2.Matrix4f invBindMatrix
The inverse bind matrix


relativeRotation

public final org.openmali.vecmath2.Quaternion4f relativeRotation
The rotation of this bone


relativeScaling

public final org.openmali.vecmath2.Tuple3f relativeScaling
The scaling of this bone, along the three axis : X, Y, and Z.


rotKeyFrames

public java.util.ArrayList<KeyFrameQuat4f> rotKeyFrames
Temporal key frames for the bone. They are reference extracted from the current animation and they will change every time you play a different animation. They are here to simplify the animation algorithm. These are ROTATION key frames.


scaleKeyFrames

public java.util.ArrayList<KeyFrameTuple3f> scaleKeyFrames
Temporal key frames for the bone. They are reference extracted from the current animation and they will change every time you play a different animation. They are here to simplify the animation algorithm. These are SCALE key frames.

Constructor Detail

Bone

public Bone(java.lang.String sid,
            java.lang.String name,
            org.openmali.vecmath2.Matrix4f matrix,
            org.openmali.vecmath2.Quaternion4f bindRotation)
Create a new Bone

Parameters:
sid -
name - The name of this bone
length - The length of this bone
bindRotation - The bind rotation of this bone
Method Detail

getSourceId

public final java.lang.String getSourceId()

getName

public final java.lang.String getName()
Returns:
the name of this bone.

setLength

public void setLength(float length)
Sets the length.

Parameters:
length -

getLength

public final float getLength()
Returns:
the length.

setBindRotation

public void setBindRotation(org.openmali.vecmath2.Quaternion4f quat)
Sets the bindRotation.

Parameters:
quat -

getBindRotation

public final org.openmali.vecmath2.Quaternion4f getBindRotation()
Returns:
the bindRotation

getAbsoluteTranslation

public final org.openmali.vecmath2.Vector3f getAbsoluteTranslation()
Get the absolute translation of this bone. Absolute translation/rotation are updated by the Skeleton.updateAbsolutes() method.

Returns:
a point3f containing the absolute translation

getAbsoluteRotation

public final org.openmali.vecmath2.Quaternion4f getAbsoluteRotation()
Get the absolute rotation of this bone. Absolute translation/rotation are updated by the Skeleton.updateAbsolutes() method.

Returns:
a quaternion containing the absolute rotation

getAbsoluteScaling

public final org.openmali.vecmath2.Tuple3f getAbsoluteScaling()

getAbsoluteTransformation

public final org.openmali.vecmath2.Matrix4f getAbsoluteTransformation()

hasKeyFrames

public final boolean hasKeyFrames()
Returns:
true if the bone has at least one key frame of any kind.

setNoRelativeMovement

public void setNoRelativeMovement()
Completes the relativeTranslation and relativeRotation all with 0.


selectCurrentRotFrame

public int selectCurrentRotFrame(long currentTime)
Selects the current translation key frame, based on the current time

Parameters:
currentTime - beetween 0 and the end of the animation, in milliseconds
Returns:
frame index selected

selectCurrentScaleFrame

public int selectCurrentScaleFrame(long currentTime)
Selects the current scaling key frame, based on the current time

Parameters:
currentTime - beetween 0 and the end of the animation, in miliseconds
Returns:
frame index selected

addChild

public void addChild(Bone bone)
Adds a child bone.

Parameters:
bone -

removeChild

public void removeChild(Bone bone)
Removes a child bone.

Parameters:
bone -

numChildren

public final int numChildren()
Returns:
the number of children of this bone.

getChild

public final Bone getChild(int i)
Gets a bone by index.

Parameters:
i - The index of the bone you want to get.
Returns:
The bone :)

toString

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