예제 #1
0
        /// <summary>
        /// Reads a 8-byte 16-bit <see cref="Quaternion"/> structure from the data stream, and advances the position of the stream by
        /// 8 bytes.
        /// </summary>
        /// <returns>The quaternion.</returns>
        /// <param name="binaryReader">The current <see cref="BinaryReader"/></param>
        public static Quaternion ReadQuaternion16(this BinaryReader binaryReader)
        {
            short x = binaryReader.ReadInt16();
            short y = binaryReader.ReadInt16();
            short z = binaryReader.ReadInt16();
            short w = binaryReader.ReadInt16();

            return(new Quaternion(ExtendedData.ShortQuatValueToFloat(x), ExtendedData.ShortQuatValueToFloat(y), ExtendedData.ShortQuatValueToFloat(z), ExtendedData.ShortQuatValueToFloat(w)));
        }
예제 #2
0
        /// <summary>
        /// Reads a 8-byte 16-bit <see cref="Quaternion"/> structure from the data stream, and advances the position of the stream by
        /// 8 bytes.
        /// </summary>
        /// <returns>The quaternion.</returns>
        /// <param name="binaryReader">The current <see cref="BinaryReader"/></param>
        public static Quaternion ReadQuaternion16(this BinaryReader binaryReader)
        {
            var   vector = binaryReader.ReadVector3s();
            short w      = binaryReader.ReadInt16();

            return(new Quaternion
                   (
                       ExtendedData.ShortQuatValueToFloat(vector.X),
                       ExtendedData.ShortQuatValueToFloat(vector.Y),
                       ExtendedData.ShortQuatValueToFloat(vector.Z),
                       ExtendedData.ShortQuatValueToFloat(w)
                   ));
        }