/// <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]); } } }
/// <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); } } }
/// <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; } } }
/// <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 ] ); } } }