org.jagatoo.loaders.models.cal3d.core
Class CalBone

java.lang.Object
  extended by org.jagatoo.loaders.models.cal3d.core.CalBone

public class CalBone
extends java.lang.Object

The bone class.


Field Summary
protected  float accumulatedWeight
           
protected  float accumulatedWeightAbsolute
           
protected  CalCoreBone coreBone
           
protected  org.openmali.vecmath2.Quaternion4f rotation
           
protected  org.openmali.vecmath2.Quaternion4f rotationAbsolute
           
protected  org.openmali.vecmath2.Quaternion4f rotationBoneSpace
           
protected  CalSkeleton skeleton
           
protected  org.openmali.vecmath2.Matrix3f tmpMatrix
           
protected  org.openmali.vecmath2.Matrix3f transformMatrix
           
protected  org.openmali.vecmath2.Vector3f translation
           
protected  org.openmali.vecmath2.Vector3f translationAbsolute
           
protected  org.openmali.vecmath2.Vector3f translationBoneSpace
           
 
Constructor Summary
CalBone(CalCoreBone coreBone)
          Constructs a bone instance from a core bone.
 
Method Summary
 void applyState(float weight, org.openmali.vecmath2.Vector3f translation, org.openmali.vecmath2.Quaternion4f rotation)
          Applies a translation and rotation to the current state, bypassing the weighted accumulators This function interpolates the current state (relative translation and rotation) of the bone instance to another state of a given weight.
 void blendState(float weight, org.openmali.vecmath2.Vector3f translation, org.openmali.vecmath2.Quaternion4f rotation)
          Interpolates the current state to another state.
 void calculateState()
          Calculates the current state.
 void clearState()
          Clears the current state.
 CalCoreBone getCoreBone()
          Provides access to the core bone.
 org.openmali.vecmath2.Quaternion4f getRotation()
          Returns the current rotation.
 org.openmali.vecmath2.Quaternion4f getRotationAbsolute()
          Returns the current absolute rotation.
 org.openmali.vecmath2.Quaternion4f getRotationBoneSpace()
          Returns the current bone space rotation.
 org.openmali.vecmath2.Matrix3f getTransformMatrix()
          Returns the current bone space translation.
 org.openmali.vecmath2.Vector3f getTranslation()
          Returns the current translation.
 org.openmali.vecmath2.Vector3f getTranslationAbsolute()
          Returns the current absolute translation.
 org.openmali.vecmath2.Vector3f getTranslationBoneSpace()
          Returns the current bone space translation.
 void lockState()
          Locks the current state.
 void setCoreState()
          Resets the bone to its core state This function changes the state of the bone to its default non-animated position and orientation.
 void setCoreStateRecursive()
          Resets the bone and children to core states This function changes the state of the bone to its default non-animated position and orientation.
 void setRotation(org.openmali.vecmath2.Quaternion4f rotation)
          Sets the current rotation.
 void setSkeleton(CalSkeleton skeleton)
          Sets the skeleton.
 void setTranslation(org.openmali.vecmath2.Vector3f translation)
          Sets the current translation.
 java.lang.String toString()
          The string representation is the name of the core bone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

coreBone

protected CalCoreBone coreBone

skeleton

protected CalSkeleton skeleton

accumulatedWeight

protected float accumulatedWeight

accumulatedWeightAbsolute

protected float accumulatedWeightAbsolute

translation

protected org.openmali.vecmath2.Vector3f translation

rotation

protected org.openmali.vecmath2.Quaternion4f rotation

translationAbsolute

protected org.openmali.vecmath2.Vector3f translationAbsolute

rotationAbsolute

protected org.openmali.vecmath2.Quaternion4f rotationAbsolute

translationBoneSpace

protected org.openmali.vecmath2.Vector3f translationBoneSpace

rotationBoneSpace

protected org.openmali.vecmath2.Quaternion4f rotationBoneSpace

transformMatrix

protected org.openmali.vecmath2.Matrix3f transformMatrix

tmpMatrix

protected org.openmali.vecmath2.Matrix3f tmpMatrix
Constructor Detail

CalBone

public CalBone(CalCoreBone coreBone)
Constructs a bone instance from a core bone. This function is the default constructor of the bone instance.

Method Detail

setCoreState

public void setCoreState()
Resets the bone to its core state This function changes the state of the bone to its default non-animated position and orientation. Child bones are unaffected and may be animated independently.


setCoreStateRecursive

public void setCoreStateRecursive()
Resets the bone and children to core states This function changes the state of the bone to its default non-animated position and orientation. All child bones are also set in this manner.


blendState

public void blendState(float weight,
                       org.openmali.vecmath2.Vector3f translation,
                       org.openmali.vecmath2.Quaternion4f rotation)
Interpolates the current state to another state. This function interpolates the current state (relative translation and rotation) of the bone instance to another state of a given weight.

Parameters:
weight - The blending weight.
translation - The relative translation to be interpolated to.
rotation - The relative rotation to be interpolated to.

applyState

public void applyState(float weight,
                       org.openmali.vecmath2.Vector3f translation,
                       org.openmali.vecmath2.Quaternion4f rotation)
Applies a translation and rotation to the current state, bypassing the weighted accumulators This function interpolates the current state (relative translation and rotation) of the bone instance to another state of a given weight.

Parameters:
weight - The blending weight.
translation - The relative translation to be interpolated to.
rotation - The relative rotation to be interpolated to.

lockState

public void lockState()
Locks the current state. This function locks the current state (absolute translation and rotation) of the bone instance and all its children.


calculateState

public void calculateState()
Calculates the current state. This function calculates the current state (absolute translation and rotation, as well as the bone space transformation) of the bone instance and all its children.


clearState

public void clearState()
Clears the current state. This function clears the current state (absolute translation and rotation) of the bone instance and all its children.


getCoreBone

public CalCoreBone getCoreBone()
Provides access to the core bone. This function returns the core bone on which this bone instance is based on.

Returns:
One of the following values: \li a pointer to the core bone \li \b 0 if an error happend

getRotation

public org.openmali.vecmath2.Quaternion4f getRotation()
Returns the current rotation. This function returns the current relative rotation of the bone instance.

Returns:
The relative rotation to the parent as quaternion.

setRotation

public void setRotation(org.openmali.vecmath2.Quaternion4f rotation)
Sets the current rotation. This function sets the current relative rotation of the bone instance. Caveat: For this change to appear, calculateState() must be called afterwards.


getRotationAbsolute

public org.openmali.vecmath2.Quaternion4f getRotationAbsolute()
Returns the current absolute rotation. This function returns the current absolute rotation of the bone instance.

Returns:
The absolute rotation to the parent as quaternion.

getRotationBoneSpace

public org.openmali.vecmath2.Quaternion4f getRotationBoneSpace()
Returns the current bone space rotation. This function returns the current rotation to bring a point into the bone instance space.

Returns:
The rotation to bring a point into bone space.

getTranslation

public org.openmali.vecmath2.Vector3f getTranslation()
Returns the current translation. This function returns the current relative translation of the bone instance.

Returns:
The relative translation to the parent as quaternion.

setTranslation

public void setTranslation(org.openmali.vecmath2.Vector3f translation)
Sets the current translation. This function sets the current relative translation of the bone instance. Caveat: For this change to appear, calculateState() must be called afterwards.


getTranslationAbsolute

public org.openmali.vecmath2.Vector3f getTranslationAbsolute()
Returns the current absolute translation. This function returns the current absolute translation of the bone instance.

Returns:
The absolute translation to the parent as quaternion.

getTranslationBoneSpace

public org.openmali.vecmath2.Vector3f getTranslationBoneSpace()
Returns the current bone space translation. This function returns the current translation to bring a point into the bone instance space.

Returns:
The translation to bring a point into bone space.

getTransformMatrix

public org.openmali.vecmath2.Matrix3f getTransformMatrix()
Returns the current bone space translation. This function returns the current translation to bring a point into the bone instance space.

Returns:
The translation to bring a point into bone space.

setSkeleton

public void setSkeleton(CalSkeleton skeleton)
Sets the skeleton. This function sets the skeleton to which the bone instance is attached to.

Parameters:
skeleton - The skeleton to which the bone instance should be attached to.

toString

public java.lang.String toString()
The string representation is the name of the core bone

Overrides:
toString in class java.lang.Object