Exemple #1
0
    // Token: 0x06004F53 RID: 20307 RVA: 0x001ACCEC File Offset: 0x001AB0EC
    private static PoseRecorder.PoseEvent LinearTweenFunction(IList <PoseRecorder.PoseEvent> l, int idx, double delta)
    {
        PoseRecorder.PoseEvent poseEvent  = l[idx];
        PoseRecorder.PoseEvent poseEvent2 = l[TweenFunctions.FindNextIndex <PoseRecorder.PoseEvent>(l, idx)];
        float t = (float)delta;

        PoseRecorder.PoseEvent poseEvent3 = new PoseRecorder.PoseEvent
        {
            poseContents = (poseEvent.poseContents & poseEvent2.poseContents),
            timeReceived = (poseEvent2.timeReceived - poseEvent.timeReceived) * delta + poseEvent.timeReceived
        };
        if (poseEvent2.Contains(PoseRecorder.PoseContents.HandGesture))
        {
            poseEvent3.handGestureLeft  = poseEvent2.handGestureLeft;
            poseEvent3.handGestureRight = poseEvent2.handGestureRight;
            poseEvent3.poseContents    |= 16;
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.Nothing))
        {
            return(poseEvent3);
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.RootOffset))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.rootOffset, Vector3.Lerp(poseEvent.rootOffset, poseEvent2.rootOffset, t), ref poseEvent3.rootOffset);
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.BaseSkeleton))
        {
            poseEvent3.boneRotations = new Quaternion[19];
            for (int i = 0; i < 19; i++)
            {
                poseEvent3.boneRotations[i] = Quaternion.Slerp(poseEvent.boneRotations[i], poseEvent2.boneRotations[i], t).Normalize();
            }
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationL))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.leftHandPosition, Vector3.Lerp(poseEvent.leftHandPosition, poseEvent2.leftHandPosition, t), ref poseEvent3.leftHandPosition);
            poseEvent3.leftHandRotation = Quaternion.Slerp(poseEvent.leftHandRotation, poseEvent2.leftHandRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HandEffectorPositionOrientationR))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.rightHandPosition, Vector3.Lerp(poseEvent.rightHandPosition, poseEvent2.rightHandPosition, t), ref poseEvent3.rightHandPosition);
            poseEvent3.rightHandRotation = Quaternion.Slerp(poseEvent.rightHandRotation, poseEvent2.rightHandRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HeadEffectorPositionOrientation))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.headPosition, Vector3.Lerp(poseEvent.headPosition, poseEvent2.headPosition, t), ref poseEvent3.headPosition);
            poseEvent3.headRotation = Quaternion.Slerp(poseEvent.headRotation, poseEvent2.headRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.HipEffectorPositionOrientation))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.hipPosition, Vector3.Lerp(poseEvent.hipPosition, poseEvent2.hipPosition, t), ref poseEvent3.hipPosition);
            poseEvent3.hipRotation = Quaternion.Slerp(poseEvent.hipRotation, poseEvent2.hipRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationL))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.leftFootPosition, Vector3.Lerp(poseEvent.leftFootPosition, poseEvent2.leftFootPosition, t), ref poseEvent3.leftFootPosition);
            poseEvent3.leftFootRotation = Quaternion.Slerp(poseEvent.leftFootRotation, poseEvent2.leftFootRotation, t).Normalize();
        }
        if (poseEvent3.Contains(PoseRecorder.PoseContents.FootEffectorPositionOrientationR))
        {
            PoseRecorder.MaybeSetPosition(poseEvent.rightFootPosition, Vector3.Lerp(poseEvent.rightFootPosition, poseEvent2.rightFootPosition, t), ref poseEvent3.rightFootPosition);
            poseEvent3.rightFootRotation = Quaternion.Slerp(poseEvent.rightFootRotation, poseEvent2.rightFootRotation, t).Normalize();
        }
        return(poseEvent3);
    }