Example #1
0
    private static uint PackHelper(float vectorX, float vectorY, float vectorZ, float vectorW)
    {
        uint num  = PackUtils.PackUNorm(255f, vectorX);
        uint num2 = PackUtils.PackUNorm(255f, vectorY) << 8;
        uint num3 = PackUtils.PackUNorm(255f, vectorZ) << 16;
        uint num4 = PackUtils.PackUNorm(255f, vectorW) << 24;

        return(num | num2 | num3 | num4);
    }
Example #2
0
        private static uint PackHelper(float vectorX, float vectorY, float vectorZ, float vectorW)
        {
            uint num4 = PackUtils.PackUNorm(255f, vectorX);
            uint num3 = PackUtils.PackUNorm(255f, vectorY) << 8;
            uint num2 = PackUtils.PackUNorm(255f, vectorZ) << 0x10;
            uint num  = PackUtils.PackUNorm(255f, vectorW) << 0x18;

            return(((num4 | num3) | num2) | num);
        }
Example #3
0
        /// <summary>
        /// 颜色的线性插值
        /// </summary>
        /// <param name="value1">颜色四元组</param>
        /// <param name="value2">颜色四元组</param>
        /// <param name="amount">插值因子</param>
        /// <returns>颜色四元组</returns>
        public static Color32 Lerp(Color32 value1, Color32 value2, float amount)
        {
            Color32 color;
            uint    packedValue = value1.packedValue;
            uint    num2        = value2.packedValue;
            int     num7        = (byte)packedValue;
            int     num6        = (byte)(packedValue >> 8);
            int     num5        = (byte)(packedValue >> 0x10);
            int     num4        = (byte)(packedValue >> 0x18);
            int     num15       = (byte)num2;
            int     num14       = (byte)(num2 >> 8);
            int     num13       = (byte)(num2 >> 0x10);
            int     num12       = (byte)(num2 >> 0x18);
            int     num         = (int)PackUtils.PackUNorm(65536f, amount);
            int     num11       = num7 + (((num15 - num7) * num) >> 0x10);
            int     num10       = num6 + (((num14 - num6) * num) >> 0x10);
            int     num9        = num5 + (((num13 - num5) * num) >> 0x10);
            int     num8        = num4 + (((num12 - num4) * num) >> 0x10);

            color.packedValue = (uint)(((num11 | (num10 << 8)) | (num9 << 0x10)) | (num8 << 0x18));
            return(color);
        }
Example #4
0
    public static Color Lerp(Color value1, Color value2, float amount)
    {
        uint  num   = value1.packedValue;
        uint  num2  = value2.packedValue;
        int   num3  = (int)((byte)num);
        int   num4  = (int)((byte)(num >> 8));
        int   num5  = (int)((byte)(num >> 16));
        int   num6  = (int)((byte)(num >> 24));
        int   num7  = (int)((byte)num2);
        int   num8  = (int)((byte)(num2 >> 8));
        int   num9  = (int)((byte)(num2 >> 16));
        int   num10 = (int)((byte)(num2 >> 24));
        int   num11 = (int)PackUtils.PackUNorm(65536f, amount);
        int   num12 = num3 + ((num7 - num3) * num11 >> 16);
        int   num13 = num4 + ((num8 - num4) * num11 >> 16);
        int   num14 = num5 + ((num9 - num5) * num11 >> 16);
        int   num15 = num6 + ((num10 - num6) * num11 >> 16);
        Color result;

        result.packedValue = (uint)(num12 | num13 << 8 | num14 << 16 | num15 << 24);
        return(result);
    }