Search in sources :

Example 6 with SkeletalAnimationFrame

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

the class LoaderMD5Anim method parseBounds.

private void parseBounds(SkeletalAnimationFrame[] frames, BufferedReader buffer) {
    try {
        String line;
        int index = 0;
        while ((line = buffer.readLine()) != null) {
            StringTokenizer parts = new StringTokenizer(line, " ");
            int numTokens = parts.countTokens();
            if (line.indexOf('}') > -1)
                return;
            if (numTokens == 0)
                continue;
            SkeletalAnimationFrame frame = new SkeletalAnimationFrame();
            frames[index++] = frame;
            // discard (
            parts.nextToken();
            Vector3 min = new Vector3(Float.parseFloat(parts.nextToken()), Float.parseFloat(parts.nextToken()), Float.parseFloat(parts.nextToken()));
            // discard )
            parts.nextToken();
            // discard (
            parts.nextToken();
            Vector3 max = new Vector3(Float.parseFloat(parts.nextToken()), Float.parseFloat(parts.nextToken()), Float.parseFloat(parts.nextToken()));
            frame.setBounds(min, max);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) SkeletalAnimationFrame(org.rajawali3d.animation.mesh.SkeletalAnimationFrame) Vector3(org.rajawali3d.math.vector.Vector3) SkeletonJoint(org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint) ParsingException(org.rajawali3d.loader.ParsingException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

SkeletalAnimationFrame (org.rajawali3d.animation.mesh.SkeletalAnimationFrame)6 SkeletonJoint (org.rajawali3d.animation.mesh.SkeletalAnimationFrame.SkeletonJoint)5 FileNotFoundException (java.io.FileNotFoundException)3 StringTokenizer (java.util.StringTokenizer)3 SkeletalAnimationSequence (org.rajawali3d.animation.mesh.SkeletalAnimationSequence)3 ParsingException (org.rajawali3d.loader.ParsingException)3 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 SkeletalAnimationChildObject3D (org.rajawali3d.animation.mesh.SkeletalAnimationChildObject3D)1 Skeleton (org.rajawali3d.animation.mesh.SkeletalAnimationFrame.Skeleton)1 SkeletalAnimationObject3D (org.rajawali3d.animation.mesh.SkeletalAnimationObject3D)1 SkeletalAnimationMaterialPlugin (org.rajawali3d.materials.plugins.SkeletalAnimationMaterialPlugin)1 Matrix4 (org.rajawali3d.math.Matrix4)1 Vector3 (org.rajawali3d.math.vector.Vector3)1