jarp
Class Skeleton

java.lang.Object
  extended by jarp.Skeleton

public class Skeleton
extends java.lang.Object

The bones hierarchy for a Java ARP avatar.


Nested Class Summary
static interface Skeleton.BoneHandler
          Bone visitor interface.
 
Field Summary
static int HEAD_4CC
          4-cc value for HEAD bone.
static int NEC1_4CC
          4-cc value for NEC1 bone.
static int ROOT_4CC
          4-cc value for ROOT bone.
 
Constructor Summary
Skeleton()
          Default constructor: no root, #bones==0, and an empty bones table.
Skeleton(JAInputStream jins)
          Reads this Skeleton from the given stream.
Skeleton(JAInputStream jins, boolean useint4cc)
          Reads this Skeleton from the given stream.
 
Method Summary
 void computeGlobalBoneTransforms()
          Recursively sets the (global) transformation matrix for each bone in the hierarchy, using its relative TR-set, and the matrix of its parent.
 Bone getBone(int fourcc)
          Returns the bone with the given Four-CC name.
 float getSkeletonYOffest()
          Returns this skeleton's global Y-offset value.
 void save(JAOutputStream jouts)
          Writes this Skeleton to the given stream.
 void save(JAOutputStream jouts, boolean useint4cc)
           
 void scanBones(Bone bone, Skeleton.BoneHandler bhdlr)
          Scans the bones hierarchy rooted at the given bone in depth-first order, using the given handler's bone visitor method.
 void scanBones(Skeleton.BoneHandler bhdlr)
          Skeleton bones traversal: performs a depth-first traversal of the skeleton hierarchy calling the given Skeleton.BoneHandler's visitor method for each bone.
 void setBones(CASTRSet[] trsets)
          Sets the bones' TR-set data from the given TR-sets.
 void setBones(CASTRSet[] trsets, float scale)
          Sets the bones' TR-sets from those given, with the given scaling (applied to the root translation only).
 void setSkeletonYOffset(float offset)
          Sets this skeleton's global Y-offset value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_4CC

public static int ROOT_4CC
4-cc value for ROOT bone.


HEAD_4CC

public static int HEAD_4CC
4-cc value for HEAD bone.


NEC1_4CC

public static int NEC1_4CC
4-cc value for NEC1 bone.

Constructor Detail

Skeleton

public Skeleton()
Default constructor: no root, #bones==0, and an empty bones table.


Skeleton

public Skeleton(JAInputStream jins)
         throws java.io.IOException
Reads this Skeleton from the given stream.

Throws:
java.io.IOException

Skeleton

public Skeleton(JAInputStream jins,
                boolean useint4cc)
         throws java.io.IOException
Reads this Skeleton from the given stream.

Throws:
java.io.IOException
Method Detail

scanBones

public void scanBones(Skeleton.BoneHandler bhdlr)
Skeleton bones traversal: performs a depth-first traversal of the skeleton hierarchy calling the given Skeleton.BoneHandler's visitor method for each bone.


scanBones

public void scanBones(Bone bone,
                      Skeleton.BoneHandler bhdlr)
Scans the bones hierarchy rooted at the given bone in depth-first order, using the given handler's bone visitor method.


getBone

public Bone getBone(int fourcc)
Returns the bone with the given Four-CC name.


getSkeletonYOffest

public float getSkeletonYOffest()
Returns this skeleton's global Y-offset value.


setSkeletonYOffset

public void setSkeletonYOffset(float offset)
Sets this skeleton's global Y-offset value.


save

public void save(JAOutputStream jouts)
          throws java.io.IOException
Writes this Skeleton to the given stream.

Throws:
java.io.IOException

save

public void save(JAOutputStream jouts,
                 boolean useint4cc)
          throws java.io.IOException
Throws:
java.io.IOException

setBones

public void setBones(CASTRSet[] trsets)
Sets the bones' TR-set data from the given TR-sets.


setBones

public void setBones(CASTRSet[] trsets,
                     float scale)
Sets the bones' TR-sets from those given, with the given scaling (applied to the root translation only).


computeGlobalBoneTransforms

public void computeGlobalBoneTransforms()
                                 throws JAException
Recursively sets the (global) transformation matrix for each bone in the hierarchy, using its relative TR-set, and the matrix of its parent.

Throws:
JAException