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; }
AIBone aiBone = AIBone.create(aiBones.get(i)); int id = boneList.size(); Bone bone = new Bone(id, aiBone.mName().dataString(), toMatrix(aiBone.mOffsetMatrix())); boneList.add(bone); int numWeights = aiBone.mNumWeights(); for (int j = 0; j < numWeights; j++) { AIVertexWeight aiWeight = aiWeights.get(j); VertexWeight vw = new VertexWeight(bone.getBoneId(), aiWeight.mVertexId(), aiWeight.mWeight()); List<VertexWeight> vertexWeightList = weightSet.get(vw.getVertexId());
AIBone aiBone = AIBone.create(aiBones.get(i)); int id = boneList.size(); Bone bone = new Bone(id, aiBone.mName().dataString(), toMatrix(aiBone.mOffsetMatrix())); boneList.add(bone); int numWeights = aiBone.mNumWeights(); for (int j = 0; j < numWeights; j++) { AIVertexWeight aiWeight = aiWeights.get(j); VertexWeight vw = new VertexWeight(bone.getBoneId(), aiWeight.mVertexId(), aiWeight.mWeight()); List<VertexWeight> vertexWeightList = weightSet.get(vw.getVertexId());
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; }