Search in sources :

Example 1 with Skeleton

use of org.rajawali3d.animation.mesh.SkeletalAnimationFrame.Skeleton in project Rajawali by Rajawali.

the class LoaderMD5Anim method parseFrame.

private void parseFrame(SkeletalAnimationFrame[] frames, int frameIndex, BufferedReader buffer) {
    try {
        String line;
        SkeletalAnimationFrame frame = frames[frameIndex];
        frame.setFrameIndex(frameIndex);
        Skeleton skeleton = frame.getSkeleton();
        SkeletonJoint[] joints = new SkeletonJoint[mNumJoints];
        float[] frameData = new float[mNumAnimatedComponents];
        int index = 0;
        while ((line = buffer.readLine()) != null) {
            line = line.replace("\t", " ");
            StringTokenizer parts = new StringTokenizer(line, " ");
            if (line.indexOf('}') > -1) {
                skeleton.setJoints(joints);
                buildFrameSkeleton(frameData, skeleton);
                return;
            }
            while (parts.hasMoreTokens()) {
                frameData[index++] = Float.parseFloat(parts.nextToken());
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) SkeletonJoint(org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint) SkeletalAnimationFrame(org.rajawali3d.animation.mesh.SkeletalAnimationFrame) Skeleton(org.rajawali3d.animation.mesh.SkeletalAnimationFrame.Skeleton) SkeletonJoint(org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint) ParsingException(org.rajawali3d.loader.ParsingException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 StringTokenizer (java.util.StringTokenizer)1 SkeletalAnimationFrame (org.rajawali3d.animation.mesh.SkeletalAnimationFrame)1 Skeleton (org.rajawali3d.animation.mesh.SkeletalAnimationFrame.Skeleton)1 SkeletonJoint (org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint)1 ParsingException (org.rajawali3d.loader.ParsingException)1