/// <summary></summary> protected override void OnEndProcessAnimation() { Matrix identity = Matrix.Identity; overrideExpression = false; expression = new Microsoft.Xna.Framework.GamerServices.AvatarExpression(); foreach (AnimationStreamControl animation in this.animations) { AvatarAnimationStreamControl anim = animation as AvatarAnimationStreamControl; if (anim != null) { overrideExpression |= anim.GetExpression(ref expression); float weight = anim.WeightedScale; if (weight == 0) continue; Matrix matrix; if (weight == 1) { //mult the bone matrices... for (int i = 0; i < this.boneList.Length; i++) { matrix = anim.BoneTransforms[i]; Transform transform = new Transform(ref matrix); Transform.Multiply(ref this.transformedBones[i], ref transform, out this.transformedBones[i]); } } else { for (int i = 0; i < this.boneList.Length; i++) { //matrices are annoying to lerp... //so.. use a transform. matrix = anim.BoneTransforms[i]; Transform transform = new Transform(ref matrix); transform.InterpolateToIdentity(weight); Transform.Multiply(ref this.transformedBones[i], ref transform, out this.transformedBones[i]); } } } } if (this.parent.sourceData != null && boneModifierBuffer != null) { boneModifierBuffer.ProcessAvatarBones(this.transformedBones, parent.sourceData, new ReadOnlyArrayCollection<Transform>(parent.bindPoseWorld), new ReadOnlyArrayCollection<Transform>(parent.bindPoseWorldInverse)); } for (int i = 0; i < this.transformedBones.Length; i++) { this.transformedBones[i].GetMatrix(out this.boneList[i]); } if (this.parent.sourceData != null && boneModifierBuffer != null && boneModifierBuffer.CallProcessReadonlyHierarchyTransformedBones) { this.parent.sourceData.skeleton.TransformHierarchy(this.transformedBones); boneModifierBuffer.ProcessReadonlyHierarchyTransformedBones(this.transformedBones, parent.sourceData, new ReadOnlyArrayCollection<Transform>(parent.bindPoseWorld), new ReadOnlyArrayCollection<Transform>(parent.bindPoseWorldInverse)); } }