/// <summary> /// Packs color values (RGB) in the range [0, 1] into one <b>uint</b>, as 11 bit unsigned float for each red and green, and 10 bit unsigned float for blue. (Reversed order of components.) /// </summary> /// <param name="red">The red color value.</param> /// <param name="green">The green color value.</param> /// <param name="blue">The blue color value.</param> /// <returns>The <b>uint</b> containing the packed color values.</returns> public static uint To_UnsignedInt_10f_11f_11f_Rev(float red, float green, float blue) { glUFloat11 r = new glUFloat11(red); glUFloat11 g = new glUFloat11(green); glUFloat10 b = new glUFloat10(blue); return(((uint)b.Value << 22) | ((uint)g.Value << 11) | r.Value); }
/// <summary> /// Returns a value indicating whether the specified number evaluates to (positive) infinity. /// </summary> /// <param name="value">An instance of this class.</param> /// <returns><b>true</b> if <paramref name="value"/> evaluates to <see cref="Infinity"/>; otherwise, <b>false</b>.</returns> public static bool IsInfinity(glUFloat11 value) { if ((value.Value & ExponentMask) != ExponentMask) { return(false); } return((value.Value & MantissaMask) == 0); }
/// <summary> /// Constructs an instance of this class with the value of the argument. /// </summary> /// <param name="value">An instance of <see cref="glUFloat11"/>.</param> public glFloat16(glUFloat11 value) { int exp = value.Value & glUFloat11.ExponentMask; int man = value.Value & glUFloat11.MantissaMask; if (exp == glUFloat11.ExponentMask) { if (man == 0) { Value = PositiveInfinity; } else { Value = NaN; } return; } Value = (ushort)((value.Value << 4) & FillMask); }
/// <summary> /// Constructs an instance of this class with the value of the argument. /// </summary> /// <param name="value">An instance of <see cref="glUFloat11"/>.</param> public glUFloat10(glUFloat11 value) { int exp = value.Value & glUFloat11.ExponentMask; int man = value.Value & glUFloat11.MantissaMask; if (exp == glUFloat11.ExponentMask) { if (man == 0) { Value = Infinity; } else { Value = NaN; } return; } Value = (ushort)(((value.Value >> 1) + (value.Value & 1)) & FillMask); }
/// <summary> /// Constructs an instance of this class with the value of the argument. /// </summary> /// <param name="value">An instance of this class.</param> public glUFloat11(glUFloat11 value) { Value = value.Value; }