Ejemplo n.º 1
0
        public static XEFBodyData FromReader(BinaryReader reader)
        {
            XEFBodyData bodyData = new XEFBodyData();

            foreach (XEFJointType jointType in Enum.GetValues(typeof(XEFJointType)))
            {
                bodyData.SkeletonJointPositions[jointType] = XEFVector.FromReader(reader);
            }

            foreach (XEFJointType jointType in Enum.GetValues(typeof(XEFJointType)))
            {
                bodyData.SkeletonJointOrientations[jointType] = XEFVector.FromReader(reader);
            }

            foreach (XEFJointType jointType in Enum.GetValues(typeof(XEFJointType)))
            {
                bodyData.SkeletonJointPositionTrackingStates[jointType] = (XEFTrackingState)reader.ReadInt32();
            }

            bodyData.ExpressionData = XEFExpressionData.FromReader(reader);

            bodyData.HandDataLeft  = XEFHandData.FromReader(reader);
            bodyData.HandDataRight = XEFHandData.FromReader(reader);

            reader.ReadInt32(); // padding

            bodyData.TrackingID    = reader.ReadUInt64();
            bodyData.TrackingState = (XEFBodyTrackingState)reader.ReadInt32();

            bodyData.LeanData = XEFLeanData.FromReader(reader);

            bodyData.QualityFlags = reader.ReadUInt32();

            return(bodyData);
        }
Ejemplo n.º 2
0
        public static XEFBodyFrame FromByteArray(byte[] data)
        {
            XEFBodyFrame bodyData = new XEFBodyFrame();

            using (MemoryStream stream = new MemoryStream(data))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    bodyData.FloorClipPlane = XEFVector.FromReader(reader);
                    bodyData.Up             = XEFVector.FromReader(reader);

                    for (int i = 0; i < BODY_DATA_SIZE; i++)
                    {
                        bodyData.BodyData[i] = XEFBodyData.FromReader(reader);
                    }

                    bodyData.QualityFlags = reader.ReadUInt32();
                    reader.ReadInt32(); // Padding
                    reader.ReadInt32();
                    reader.ReadInt32();
                }
            }
            return(bodyData);
        }