コード例 #1
0
        /// <inheritdoc/>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="value0"/>, <paramref name="value1"/> or <paramref name="result"/> is
        /// <see langword="null"/>.
        /// </exception>
        public void Add(ref SkeletonPose value0, ref SkeletonPose value1, ref SkeletonPose result)
        {
            if (value0 == null)
            {
                throw new ArgumentNullException("value0");
            }
            if (value1 == null)
            {
                throw new ArgumentNullException("value1");
            }
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            var boneTransforms0  = value0.BoneTransforms;
            var boneTransforms1  = value1.BoneTransforms;
            var resultTransforms = result.BoneTransforms;

            for (int i = 0; i < resultTransforms.Length; i++)
            {
                resultTransforms[i] = boneTransforms1[i] * boneTransforms0[i];
            }

            result.Invalidate();
        }
コード例 #2
0
        /// <inheritdoc/>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="source"/>, <paramref name="target"/> or <paramref name="result"/> is
        /// <see langword="null"/>.
        /// </exception>
        public void Interpolate(ref SkeletonPose source, ref SkeletonPose target, float parameter, ref SkeletonPose result)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            var sourceTransforms = source.BoneTransforms;
            var targetTransforms = target.BoneTransforms;
            var resultTransforms = result.BoneTransforms;

            for (int i = 0; i < resultTransforms.Length; i++)
            {
                SrtTransform.Interpolate(ref sourceTransforms[i], ref targetTransforms[i], parameter, ref resultTransforms[i]);
            }

            result.Invalidate();
        }
コード例 #3
0
        /// <inheritdoc/>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="value"/> is <see langword="null"/>.
        /// </exception>
        public void EndBlend(ref SkeletonPose value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var transforms = value.BoneTransforms;

            for (int i = 0; i < transforms.Length; i++)
            {
                transforms[i].Rotation.Normalize();
            }

            value.Invalidate();
        }
コード例 #4
0
        /// <summary>
        /// Copies the bone transforms from skeleton pose to another skeleton pose.
        /// </summary>
        /// <param name="source">The <see cref="SkeletonPose"/> from which the bone transforms are copied.</param>
        /// <param name="target">The <see cref="SkeletonPose"/> to which the bone transforms are copied.</param>
        /// <remarks>
        /// Copying a <see cref="SkeletonPose"/> using this method is faster than manually copying all
        /// bone transforms.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="source"/> or <paramref name="target"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="source"/> and <paramref name="target"/> belong to different skeletons and
        /// <paramref name="target"/> has more bones than <paramref name="source"/>.
        /// </exception>
        public static void Copy(SkeletonPose source, SkeletonPose target)
        {
            if (source == null)
            throw new ArgumentNullException("source");
              if (target == null)
            throw new ArgumentNullException("target");

              if (target != source)
              {
            var sourceTransforms = source.BoneTransforms;
            var targetTransforms = target.BoneTransforms;
            Array.Copy(sourceTransforms, 0, targetTransforms, 0, targetTransforms.Length);
            target.Invalidate();
              }
        }