Beispiel #1
0
 /// <summary>
 /// Serialize an array of animation curves as binary data, ignoring tangents.
 /// </summary>
 public static void WriteBoolCurveArray(BinaryWriter writer, AnimationCurve[] curves, float startTime)
 {
     foreach (AnimationCurve curve in curves)
     {
         InputAnimationSerializationUtils.WriteBoolCurve(writer, curve, startTime);
     }
 }
        /// <summary>
        /// Serialize animation data into a stream.
        /// </summary>
        public void ToStream(Stream stream, float startTime)
        {
            PoseCurves defaultCurves = new PoseCurves();

            var writer = new BinaryWriter(stream);

            InputAnimationSerializationUtils.WriteHeader(writer);

            PoseCurvesToStream(writer, cameraCurves, startTime);

            InputAnimationSerializationUtils.WriteBoolCurve(writer, handTrackedCurveLeft, startTime);
            InputAnimationSerializationUtils.WriteBoolCurve(writer, handTrackedCurveRight, startTime);
            InputAnimationSerializationUtils.WriteBoolCurve(writer, handPinchCurveLeft, startTime);
            InputAnimationSerializationUtils.WriteBoolCurve(writer, handPinchCurveRight, startTime);

            for (int i = 0; i < jointCount; ++i)
            {
                if (!handJointCurvesLeft.TryGetValue((TrackedHandJoint)i, out PoseCurves curves))
                {
                    curves = defaultCurves;
                }
                PoseCurvesToStream(writer, curves, startTime);
            }
            for (int i = 0; i < jointCount; ++i)
            {
                if (!handJointCurvesRight.TryGetValue((TrackedHandJoint)i, out PoseCurves curves))
                {
                    curves = defaultCurves;
                }
                PoseCurvesToStream(writer, curves, startTime);
            }

            InputAnimationSerializationUtils.WriteMarkerList(writer, markers, startTime);
        }