public void ImportSkeleton( Stream stream, Skeleton skeleton )
{
// store a local reference to the mesh for modification
this.skeleton = skeleton;
BinaryReader reader = new BinaryReader( stream, System.Text.Encoding.UTF8 );
// start off by taking a look at the header
ReadFileHeader( reader );
SkeletonChunkID chunkID = 0;
while ( !IsEOF( reader ) )
{
chunkID = ReadChunk( reader );
switch ( chunkID )
{
case SkeletonChunkID.Bone:
ReadBone( reader );
break;
case SkeletonChunkID.BoneParent:
ReadBoneParent( reader );
break;
case SkeletonChunkID.Animation:
ReadAnimation( reader );
break;
case SkeletonChunkID.AttachmentPoint:
ReadAttachmentPoint( reader );
break;
default:
LogManager.Instance.Write( "Can only parse bones, parents, and animations at the top level during skeleton loading." );
LogManager.Instance.Write( "Unexpected chunk: " + chunkID.ToString() );
break;
} // switch
} // while
// assume bones are stored in binding pose
skeleton.SetBindingPose();
}