Hi!
I’m trying to implement an animation loader using Assimp (I don’t want to make a XML loader to do it using Collada) in Java.
Using that piece of code I can get the mesh bones, but in a list-like format:
AIScene scene = Assimp.aiImportFile(path, Assimp.aiProcess_JoinIdenticalVertices | Assimp.aiProcess_Triangulate);
AIMesh mesh = AIMesh.create(scene.mMeshes().get(0));
/*
Of course I do my own bone class and store the attributes,
that's just an example of data storing.
*/
ArrayList<AIBone> bones = new ArrayList<>();
for(int b = 0; b < mesh.mNumBones(); b++){
AIBone bone = AIBone.create(mesh.mBones().get(b));
bones.add(bone);
}
But the problem is that the algorithm I’ll need to make in order to calculate the bone transforms will have, obviously, a complexity of O(n²) because of the list storage method.
The better way to reduce the complexity, as far as I know, is storing the bones on a graph structure like a skeleton graph, then I’ll can make a recursive method to calculate the bone transforms.
I don’t know how I can get the hierarchical order of the bones to do it.
Is there some way to make a bone graph using Assimp?
Thanks in advance.
PS. I really don’t know if the forum consider Assimp topics as an OpenGL topic, so, please, forgive me if it’s the wrong place to discuss about Assimp.