public int getAnimationFrames() { int numFrames = this.transformations.size(); for (Node child : children) { int childFrame = child.getAnimationFrames(); numFrames = Math.max(numFrames, childFrame); } return numFrames; }
public int getAnimationFrames() { int numFrames = this.transformations.size(); for (Node child : children) { int childFrame = child.getAnimationFrames(); numFrames = Math.max(numFrames, childFrame); } return numFrames; }
private static List<AnimatedFrame> buildAnimationFrames(List<Bone> boneList, Node rootNode, Matrix4f rootTransformation) { int numFrames = rootNode.getAnimationFrames(); List<AnimatedFrame> frameList = new ArrayList<>(); for (int i = 0; i < numFrames; i++) { AnimatedFrame frame = new AnimatedFrame(); frameList.add(frame); int numBones = boneList.size(); for (int j = 0; j < numBones; j++) { Bone bone = boneList.get(j); Node node = rootNode.findByName(bone.getBoneName()); Matrix4f boneMatrix = Node.getParentTransforms(node, i); boneMatrix.mul(bone.getOffsetMatrix()); boneMatrix = new Matrix4f(rootTransformation).mul(boneMatrix); frame.setMatrix(j, boneMatrix); } } return frameList; }
private static List<AnimatedFrame> buildAnimationFrames(List<Bone> boneList, Node rootNode, Matrix4f rootTransformation) { int numFrames = rootNode.getAnimationFrames(); List<AnimatedFrame> frameList = new ArrayList<>(); for (int i = 0; i < numFrames; i++) { AnimatedFrame frame = new AnimatedFrame(); frameList.add(frame); int numBones = boneList.size(); for (int j = 0; j < numBones; j++) { Bone bone = boneList.get(j); Node node = rootNode.findByName(bone.getBoneName()); Matrix4f boneMatrix = Node.getParentTransforms(node, i); boneMatrix.mul(bone.getOffsetMatrix()); boneMatrix = new Matrix4f(rootTransformation).mul(boneMatrix); frame.setMatrix(j, boneMatrix); } } return frameList; }