コード例 #1
0
        static bool Test()
        {
#if DEBUG && !MATRIXFRAMES
            Keyframe kf = new Keyframe();
            Matrix   mx = Matrix.CreateScale(0.15f, 0.20f, 0.25f) *
                          Matrix.CreateRotationY((float)(Math.PI / 6)) *
                          Matrix.CreateRotationX(0.1f) *
                          Matrix.CreateRotationZ(-0.1f) *
                          Matrix.CreateTranslation(2, 0, 1);
            Keyframe.CreateFromMatrix(ref mx, kf);
            Matrix two;
            kf.ToMatrix(out two);
            Matrix three = Matrix.Invert(mx) * two;
            //  verify that forward and back is transparent
            for (int i = 0; i != 16; ++i)
            {
                float f = MatrixElement(ref three, i);
                if ((i % 5) == 0)
                {
                    System.Diagnostics.Debug.Assert(Math.Abs(f - 1) < 1e-4);
                }
                else
                {
                    System.Diagnostics.Debug.Assert(Math.Abs(f) < 1e-4);
                }
            }
#endif
            return(true);
        }
コード例 #2
0
 /// <summary>
 /// Remove all currently playing animations and set a clean slate.
 /// </summary>
 public void Reset()
 {
     keyframes_ = new Keyframe[target_.Bones.Count];
     for (int i = 0, n = target_.Bones.Count; i != n; ++i)
     {
         keyframes_[i] = Keyframe.CreateFromMatrix(target_.Bones[i].Transform);
     }
     dirty_ = true;
     foreach (IBlendedAnimation ba in blendedAnimations_)
     {
         (ba as BlendedAnimation).Detach();
     }
     blendedAnimations_.Clear();
     foreach (IBlendedAnimation ca in composedAnimations_)
     {
         (ca as BlendedAnimation).Detach();
     }
     composedAnimations_.Clear();
     transitions_.Clear();
 }