private static void IterateBoneTree(EngineBone dstParentBone, CParser.Assimp.LoaderSkeletonBone srcParentNode) { foreach (var srcNode in srcParentNode.GetChildren()) { EngineBone dstChildBone = new EngineBone(srcNode.GetBoneId(), srcNode.GetBoneInfo().Name, dstParentBone); dstChildBone.SetOffsetMatrix(ConvertAssimpMatrix4x4ToOpenTKMatrix4(srcNode.GetBoneInfo().OffsetMatrix)); dstParentBone.AddChildBone(dstChildBone); IterateBoneTree(dstChildBone, srcNode); } }
public static EngineParentBone ConvertAssimpBoneToEngineBone(CParser.Assimp.LoaderSkeletonParentBone rootBone) { EngineParentBone resultBone = new EngineParentBone(); foreach (var bone in rootBone.GetChildren()) { EngineBone root = new EngineBone(bone.GetBoneId(), bone.GetBoneInfo().Name, null); root.SetOffsetMatrix(ConvertAssimpMatrix4x4ToOpenTKMatrix4(bone.GetBoneInfo().OffsetMatrix)); IterateBoneTree(root, bone); resultBone.AddChildBone(root); } return(resultBone); }