com.threed.jpct.skeleton
Class SimpleBone

java.lang.Object
  extended by com.threed.jpct.skeleton.SimpleBone

public class SimpleBone
extends java.lang.Object

Provides a simple implementation of a bone. A bone has two unique identifiers - id and name. The local rotations and translations are stored, along with the bones keyframes, and parent/child references.

Author:
mcgreevyj

Field Summary
 Matrix matrixAbsolute
           
 Matrix matrixFinal
           
 Matrix matrixRelative
           
 Matrix rotationAbsolute
           
 Matrix rotationFinal
           
 
Constructor Summary
SimpleBone(int id, java.lang.String name)
           
 
Method Summary
 void addChild(SimpleBone child)
          Adds a child reference to the bone.
 java.util.Hashtable<java.lang.Integer,SimpleBone> getChildren()
          Returns a hashtable containing all of the bone's children.
 SimpleBone getParent()
          Returns the parent bone.
 void setKeyframes(int i, RotationKeyframe[] rotationKeyframes, TranslationKeyframe[] translationKeyframes)
          Sets the translation, and rotation keyframes for this bone.
 void setLocalRotation(float x, float y, float z, float angle)
          Sets the local rotation axis of the bone.
 void setLocalTranslation(float x, float y, float z)
          Sets the local translation vector for this bone.
 void setMaxAnimations(int max)
          Initializes the keyframe arrays, to support the maximum animation size.
 void setParent(SimpleBone parent)
          Sets the parent bone of this bone.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrixAbsolute

public Matrix matrixAbsolute

matrixRelative

public Matrix matrixRelative

matrixFinal

public Matrix matrixFinal

rotationAbsolute

public Matrix rotationAbsolute

rotationFinal

public Matrix rotationFinal
Constructor Detail

SimpleBone

public SimpleBone(int id,
                  java.lang.String name)
Method Detail

setLocalTranslation

public void setLocalTranslation(float x,
                                float y,
                                float z)
Sets the local translation vector for this bone.

Parameters:
x - the x translation
y - the y translation
z - the z translation

setLocalRotation

public void setLocalRotation(float x,
                             float y,
                             float z,
                             float angle)
Sets the local rotation axis of the bone. This axis is used in conjunction with the rotation angle, to get a local rotation matrix.

Parameters:
x - the x axis rotation
y - the y axis rotation
z - the z axis rotation

setKeyframes

public void setKeyframes(int i,
                         RotationKeyframe[] rotationKeyframes,
                         TranslationKeyframe[] translationKeyframes)
Sets the translation, and rotation keyframes for this bone.

Parameters:
i - the animation index to add keyframes to
rotationKeyframes - the rotation keyframes
translationKeyframes - the translation keyframes

setMaxAnimations

public void setMaxAnimations(int max)
Initializes the keyframe arrays, to support the maximum animation size.

Parameters:
max - the number of animations to cater for.

setParent

public void setParent(SimpleBone parent)
Sets the parent bone of this bone. The bone will inherit all transformations from the parent bone.

Parameters:
parent - The parent bone

addChild

public void addChild(SimpleBone child)
Adds a child reference to the bone. This should not be called directly - it is called by setParent on the child bone.

Parameters:
child - The child bone to add a reference to

getParent

public SimpleBone getParent()
Returns the parent bone.

Returns:
The parent bone.

getChildren

public java.util.Hashtable<java.lang.Integer,SimpleBone> getChildren()
Returns a hashtable containing all of the bone's children. The hashtable uses the bone ids as a key.

Returns:
hashtable containing children.