Exemplo n.º 1
0
        public static uint PackSNorm(uint bitmask, float value)
        {
            float max = (float)(bitmask >> 1);

            value *= max;
            return((uint)(int)PackUtils.ClampAndRound(value, -max, max) & bitmask);
        }
Exemplo n.º 2
0
        public static uint PackSigned(uint bitmask, float value)
        {
            float max = (float)(bitmask >> 1);
            float min = (float)(-(double)max - 1.0);

            return((uint)(int)PackUtils.ClampAndRound(value, min, max) & bitmask);
        }
Exemplo n.º 3
0
        public static Color32 Lerp(Color32 value1, Color32 value2, float amount)
        {
            uint    packedValue1 = value1.packedValue;
            uint    packedValue2 = value2.packedValue;
            int     num1         = (int)(byte)packedValue1;
            int     num2         = (int)(byte)(packedValue1 >> 8);
            int     num3         = (int)(byte)(packedValue1 >> 16);
            int     num4         = (int)(byte)(packedValue1 >> 24);
            int     num5         = (int)(byte)packedValue2;
            int     num6         = (int)(byte)(packedValue2 >> 8);
            int     num7         = (int)(byte)(packedValue2 >> 16);
            int     num8         = (int)(byte)(packedValue2 >> 24);
            int     num9         = (int)PackUtils.PackUNorm(65536f, amount);
            int     num10        = num1 + ((num5 - num1) * num9 >> 16);
            int     num11        = num2 + ((num6 - num2) * num9 >> 16);
            int     num12        = num3 + ((num7 - num3) * num9 >> 16);
            int     num13        = num4 + ((num8 - num4) * num9 >> 16);
            Color32 color32;

            color32.packedValue = (uint)(num10 | num11 << 8 | num12 << 16 | num13 << 24);
            return(color32);
        }
Exemplo n.º 4
0
 public static uint PackUnsigned(float bitmask, float value)
 {
     return((uint)PackUtils.ClampAndRound(value, 0.0f, bitmask));
 }
Exemplo n.º 5
0
 public static uint PackUNorm(float bitmask, float value)
 {
     value *= bitmask;
     return((uint)PackUtils.ClampAndRound(value, 0.0f, bitmask));
 }