private void GoThroughBoneHierarchy(Bone parent, ref Matrix4 parentMatrix, List <Matrix4> srcTransformation, ref List <Matrix4> dstMatrices) { foreach (Bone child in parent.GetChildren()) { Matrix4 currentBoneMatrix = srcTransformation[child.GetId()] * parentMatrix; dstMatrices.Add(currentBoneMatrix); GoThroughBoneHierarchy(child, ref currentBoneMatrix, srcTransformation, ref dstMatrices); } }
private void IterateUndoOffsetHierarchy(Bone parent, ref Matrix4 toParentSpaceMatrix, List <Matrix4> toBoneSpaceMatrices, ref List <Matrix4> toParentSpaceMatrices) { foreach (var child in parent.GetChildren()) { Matrix4 fromBoneSpaceMatrix = toBoneSpaceMatrices[child.GetId()].Inverted(); Matrix4 childToParentSpaceMatrix = fromBoneSpaceMatrix * toParentSpaceMatrix; toParentSpaceMatrices.Add(childToParentSpaceMatrix); IterateUndoOffsetHierarchy(child, ref toParentSpaceMatrix, toBoneSpaceMatrices, ref toParentSpaceMatrices); } }