Exemplo n.º 1
0
        public void ComputeAbsoluteTransforms()
        {
            Vector2 localFlipping = flipping;

            if (currentAnim != null && currentAnim.Anim != null)
            {
                localFlipping *= currentAnim.Anim.Flipping;
            }

            for (int i = 0; i < Clip.Joints.Length; i++)
            {
                Joint joint = Clip.Joints[i];
                if (joint.ParentId < 0)
                {
                    if (i == 0 && linkToParentClipInstance != null)
                    {
                        Transform2D.Compose(ref linkToParentClipInstance.AbsoluteTransforms[linkToParetJointId], ref JointStates[0].Transform, ref localFlipping, out AbsoluteTransforms[0]);
                    }
                    else
                    {
                        AbsoluteTransforms[i] = JointStates[i].Transform;
                    }
                }
                else
                {
                    Transform2D.Compose(ref AbsoluteTransforms[joint.ParentId], ref JointStates[i].Transform, ref localFlipping, out AbsoluteTransforms[i]);
                }
            }
        }
Exemplo n.º 2
0
 public void ComputeAbsoluteTransforms()
 {
     for (int i = 0; i < Clip.Joints.Length; i++)
     {
         Joint joint = Clip.Joints[i];
         if (joint.ParentId < 0)
         {
             AbsoluteTransforms[i] = JointStates[i].Transform; //.Translate(JointStates[i].Origin);
         }
         else
         {
             Transform2D combinedTransform;
             // Translate current local transform to origin
             Transform2D thisAtOrigin = JointStates[i].Transform.Translate(-JointStates[i].Origin);
             // Compose with parent absolute transform
             Transform2D.Compose(ref AbsoluteTransforms[joint.ParentId], ref thisAtOrigin, out combinedTransform);
             // Move back to original position, but with parent scale applied
             AbsoluteTransforms[i] = combinedTransform.Translate(JointStates[i].Origin * AbsoluteTransforms[joint.ParentId].Scale);
         }
     }
 }
Exemplo n.º 3
0
 public void ComputeAbsoluteTransforms()
 {
     for (int i = 0; i < Clip.Joints.Length; i++)
     {
         Joint joint = Clip.Joints[i];
         if (joint.ParentId < 0)
         {
             if (i == 0 && linkToParentClipInstance != null)
             {
                 Transform2D.Compose(ref linkToParentClipInstance.AbsoluteTransforms[linkToParetJointId], ref JointStates[0].Transform, out AbsoluteTransforms[0]);
             }
             else
             {
                 AbsoluteTransforms[i] = JointStates[i].Transform;
             }
         }
         else
         {
             Transform2D.Compose(ref AbsoluteTransforms[joint.ParentId], ref JointStates[i].Transform, out AbsoluteTransforms[i]);
         }
     }
 }