コード例 #1
0
ファイル: Serializer.cs プロジェクト: bostich83/axiom
        /// <summary>
        ///		Writes a specified number of floats.
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="count">Number of values to write.</param>
        /// <param name="src">Pointer that holds the values.</param>
        protected void WriteFloats(BinaryWriter writer, int count, BufferBase src)
        {
#if !AXIOM_SAFE_ONLY
            unsafe
#endif
            {
                var pointer = src.ToFloatPointer();

                for (var i = 0; i < count; i++)
                {
                    writer.Write(pointer[i]);
                }
            }
        }
コード例 #2
0
ファイル: Serializer.cs プロジェクト: bostich83/axiom
        /// <summary>
        ///		Reads a specified number of floats and copies them into the destination pointer.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="count">Number of values to read.</param>
        /// <param name="dest">Pointer to copy the values into.</param>
        protected void ReadFloats(BinaryReader reader, int count, BufferBase dest)
        {
            // blast the data into the buffer
#if !AXIOM_SAFE_ONLY
            unsafe
#endif
            {
                var pointer = dest.ToFloatPointer();

                for (var i = 0; i < count; i++)
                {
                    pointer[i] = ReadFloat(reader);
                }
            }
        }
コード例 #3
0
ファイル: Serializer.cs プロジェクト: ryan-bunker/axiom3d
		/// <summary>
		///		Reads a specified number of floats and copies them into the destination pointer.
		/// </summary>
		/// <remarks>This overload will also copy the values into the specified destination array.</remarks>
		/// <param name="reader"></param>
		/// <param name="count">Number of values to read.</param>
		/// <param name="dest">Pointer to copy the values into.</param>
		/// <param name="destArray">A float array that is to have the values copied into it at the same time as 'dest'.</param>
		protected void ReadFloats( BinaryReader reader, int count, BufferBase dest, float[] destArray )
		{
			// blast the data into the buffer
#if !AXIOM_SAFE_ONLY
			unsafe
#endif
			{
				var pointer = dest.ToFloatPointer();

				for ( var i = 0; i < count; i++ )
				{
					var val = ReadFloat( reader );
					pointer[ i ] = val;
					destArray[ i ] = val;
				}
			}
		}
コード例 #4
0
ファイル: Serializer.cs プロジェクト: ryan-bunker/axiom3d
		/// <summary>
		///		Writes a specified number of floats.
		/// </summary>
		/// <param name="writer"></param>
		/// <param name="count">Number of values to write.</param>
		/// <param name="src">Pointer that holds the values.</param>
		protected void WriteFloats( BinaryWriter writer, int count, BufferBase src )
		{
#if !AXIOM_SAFE_ONLY
			unsafe
#endif
			{
				var pointer = src.ToFloatPointer();

				for ( var i = 0; i < count; i++ )
				{
					writer.Write( pointer[ i ] );
				}
			}
		}