/// <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);
        }
示例#2
0
 /// <summary>
 /// Returns a value that indicates whether the specified value is not a number (<see cref="NaN"/>).
 /// </summary>
 /// <param name="value">An instance of this class.</param>
 /// <returns><b>true</b> if <paramref name="value"/> evaluates to <see cref="NaN"/>; otherwise, <b>false</b>.</returns>
 public static bool IsNaN(glUFloat10 value)
 {
     if ((value.Value & ExponentMask) != ExponentMask)
     {
         return(false);
     }
     return((value.Value & MantissaMask) != 0);
 }
示例#3
0
        /// <summary>
        /// Constructs an instance of this class with the value of the argument.
        /// </summary>
        /// <param name="value">An instance of <see cref="glUFloat10"/>.</param>
        public glFloat16(glUFloat10 value)
        {
            int exp = value.Value & glUFloat10.ExponentMask;
            int man = value.Value & glUFloat10.MantissaMask;

            if (exp == glUFloat10.ExponentMask)
            {
                if (man == 0)
                {
                    Value = PositiveInfinity;
                }
                else
                {
                    Value = NaN;
                }
                return;
            }

            Value = (ushort)((value.Value << 5) & FillMask);
        }
示例#4
0
 /// <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(glUFloat10 value)
 {
     return(value.Value == Infinity);
 }
示例#5
0
 /// <summary>
 /// Constructs an instance of this class with the value of the argument.
 /// </summary>
 /// <param name="value">An instance of this class.</param>
 public glUFloat10(glUFloat10 value)
 {
     Value = value.Value;
 }