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

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

public class CalSkeleton
extends java.lang.Object

An instance of a core skeleton with its own positions for the bones. The Cal3d structure is very open but it is my intention to close this off and move much of the data into native storage so an optimised mechanism can do the bone transforms - either using the vector co-pro or on the graphics hardware with a vertex program. In the meantime avoid manipulating CalBones directly.


Field Summary
protected  CalCoreSkeleton coreSkeleton
           
protected  CalBone[] vectorBone
           
 
Constructor Summary
CalSkeleton(CalCoreSkeleton coreSkeleton)
          Constructs the skeleton instance based on a core skeleton.
 
Method Summary
 void calculateState()
          Calculates the state of the skeleton instance.
 void clearState()
          Clears the state of the skeleton instance.
 CalBone getBone(int boneId)
          Provides access to a bone.
 org.openmali.vecmath2.Quaternion4f getBoneRotation(CalCoreBone coreBone)
          Gets the rotation needed to go from the skeleton origin to the bone end.
 CalBone[] getBones()
           
 org.openmali.vecmath2.Vector3f getBoneTranslation(CalCoreBone coreBone)
          Gets the translation needed to go from the skeleton origin to the bone end.
 CalCoreSkeleton getCoreSkeleton()
          Provides access to the core skeleton.
 void lockState()
          Locks the state of the skeleton instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coreSkeleton

protected CalCoreSkeleton coreSkeleton

vectorBone

protected CalBone[] vectorBone
Constructor Detail

CalSkeleton

public CalSkeleton(CalCoreSkeleton coreSkeleton)
Constructs the skeleton instance based on a core skeleton. This function is the default constructor of the skeleton instance.

Parameters:
coreSkeleton - the core skeleton on which this skeleton instance should be based on.
Method Detail

calculateState

public void calculateState()
Calculates the state of the skeleton instance. This function calculates the state of the skeleton instance by recursively calculating the states of its bones.


clearState

public void clearState()
Clears the state of the skeleton instance. This function clears the state of the skeleton instance by recursively clearing the states of its bones.


getBone

public CalBone getBone(int boneId)
Provides access to a bone. This function returns the bone with the given ID.

Parameters:
boneId - The ID of the bone that should be returned.
Returns:
the bone

getBoneTranslation

public org.openmali.vecmath2.Vector3f getBoneTranslation(CalCoreBone coreBone)
Gets the translation needed to go from the skeleton origin to the bone end.


getBoneRotation

public org.openmali.vecmath2.Quaternion4f getBoneRotation(CalCoreBone coreBone)
Gets the rotation needed to go from the skeleton origin to the bone end.


getCoreSkeleton

public CalCoreSkeleton getCoreSkeleton()
Provides access to the core skeleton. This function returns the core skeleton on which this skeleton instance is based on.

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

getBones

public CalBone[] getBones()
Returns:
the bone vector. This function returns the vector that contains all bones of the skeleton instance.

lockState

public void lockState()
Locks the state of the skeleton instance. This function locks the state of the skeleton instance by recursively locking the states of its bones.