//--------------------------------------------------------------------- void SkeletonSerializer::importSkeleton(DataStreamPtr& stream, Skeleton* pSkel) { // Determine endianness (must be the first thing we do!) determineEndianness(stream); // Check header readFileHeader(stream); unsigned short streamID; while(!stream->eof()) { streamID = readChunk(stream); switch (streamID) { case SKELETON_BONE: readBone(stream, pSkel); break; case SKELETON_BONE_PARENT: readBoneParent(stream, pSkel); break; case SKELETON_ANIMATION: readAnimation(stream, pSkel); break; case SKELETON_ANIMATION_LINK: readSkeletonAnimationLink(stream, pSkel); break; } } // Assume bones are stored in the binding pose pSkel->setBindingPose(); }
//--------------------------------------------------------------------- void SkeletonSerializer::importSkeleton(DataStreamPtr& stream, Skeleton* pSkel) { // Determine endianness (must be the first thing we do!) determineEndianness(stream); // Check header readFileHeader(stream); pushInnerChunk(stream); unsigned short streamID = readChunk(stream); while(!stream->eof()) { switch (streamID) { case SKELETON_BLENDMODE: { // Optional blend mode uint16 blendMode; readShorts(stream, &blendMode, 1); pSkel->setBlendMode(static_cast<SkeletonAnimationBlendMode>(blendMode)); break; } case SKELETON_BONE: readBone(stream, pSkel); break; case SKELETON_BONE_PARENT: readBoneParent(stream, pSkel); break; case SKELETON_ANIMATION: readAnimation(stream, pSkel); break; case SKELETON_ANIMATION_LINK: readSkeletonAnimationLink(stream, pSkel); break; default: break; } streamID = readChunk(stream); } // Assume bones are stored in the binding pose pSkel->setBindingPose(); popInnerChunk(stream); }