Exemplo n.º 1
0
 /// <summary>
 /// Converts a 12-byte set to a color.
 /// Inverts <see cref="ToBytes(byte[], int)"/>.
 /// </summary>
 /// <param name="b">The byte input.</param>
 /// <param name="offset">The offset in the byte array.</param>
 /// <returns>The color.</returns>
 public static Color3F FromBytes(byte[] b, int offset = 0)
 {
     return(new Color3F(
                PrimitiveConversionHelper.BytesToFloat32(b, offset),
                PrimitiveConversionHelper.BytesToFloat32(b, offset + 4),
                PrimitiveConversionHelper.BytesToFloat32(b, offset + (4 + 4))
                ));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Read a float (4 bytes).
 /// </summary>
 public float ReadFloat()
 {
     ReadBytes(HelperBytes, 0, 4);
     return(PrimitiveConversionHelper.BytesToFloat32(HelperBytes));
 }