Пример #1
0
 private void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
 {
     time *= 2f;
     for (int i = 0; i < fragment.Count; i++)
     {
         Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
         Vector4 backgroundColor       = _backgroundColor;
         float   num   = time * 0.5f + canvasPositionOfIndex.X + canvasPositionOfIndex.Y;
         float   value = (float)Math.Cos(num) * 2f + 2f;
         value = MathHelper.Clamp(value, 0f, 1f);
         num   = (num + (float)Math.PI) % ((float)Math.PI * 6f);
         Vector4 value2;
         if (num < (float)Math.PI * 2f)
         {
             float staticNoise = NoiseHelper.GetStaticNoise(canvasPositionOfIndex * 0.3f + new Vector2(12.5f, time * 0.2f));
             staticNoise = Math.Max(0f, 1f - staticNoise * staticNoise * 4f * staticNoise);
             staticNoise = MathHelper.Clamp(staticNoise, 0f, 1f);
             value2      = Vector4.Lerp(_fireDarkColor, _fireBrightColor, staticNoise);
         }
         else if (num < (float)Math.PI * 4f)
         {
             float dynamicNoise = NoiseHelper.GetDynamicNoise(new Vector2((canvasPositionOfIndex.X + canvasPositionOfIndex.Y) * 0.2f, 0f), time / 5f);
             dynamicNoise = Math.Max(0f, 1f - dynamicNoise * 1.5f);
             value2       = Vector4.Lerp(_iceDarkColor, _iceBrightColor, dynamicNoise);
         }
         else
         {
             float dynamicNoise2 = NoiseHelper.GetDynamicNoise(canvasPositionOfIndex * 0.15f, time * 0.05f);
             dynamicNoise2 = (float)Math.Sin(dynamicNoise2 * 15f) * 0.5f + 0.5f;
             dynamicNoise2 = Math.Max(0f, 1f - 5f * dynamicNoise2);
             value2        = Vector4.Lerp(_lightningDarkColor, _lightningBrightColor, dynamicNoise2);
         }
         backgroundColor = Vector4.Lerp(backgroundColor, value2, value);
         fragment.SetColor(i, backgroundColor);
     }
 }
Пример #2
0
        private void ProcessHighDetail(RgbDevice device, Fragment fragment, EffectDetailLevel quality, float time)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0009: Unknown result type (might be due to invalid IL or missing references)
            //IL_000f: Invalid comparison between Unknown and I4
            //IL_0014: Unknown result type (might be due to invalid IL or missing references)
            if ((int)device.Type != 0 && (int)device.Type != 6)
            {
                ProcessLowDetail(device, fragment, quality, time);
                return;
            }
            bool  flag = true;
            float num  = time * 0.1f % 2f;

            if (num > 1f)
            {
                num  = 2f - num;
                flag = false;
            }
            Vector2 vector = new Vector2(num * 7f - 3.5f, 0f) + fragment.get_CanvasCenter();

            for (int i = 0; i < fragment.Count; i++)
            {
                Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(i);
                Point   gridPositionOfIndex   = fragment.GetGridPositionOfIndex(i);
                Vector4 vector2 = _backgroundColor;
                Vector2 vector3 = canvasPositionOfIndex - vector;
                float   num2    = vector3.Length();
                if (num2 < 0.5f)
                {
                    float amount = 1f - MathHelper.Clamp((num2 - 0.5f + 0.2f) / 0.2f, 0f, 1f);
                    float num3   = MathHelper.Clamp((vector3.X + 0.5f - 0.2f) / 0.6f, 0f, 1f);
                    if (flag)
                    {
                        num3 = 1f - num3;
                    }
                    Vector4 value  = Vector4.Lerp(_eyeColor, _veinColor, num3);
                    float   value2 = (float)Math.Atan2(vector3.Y, vector3.X);
                    if (!flag && (float)Math.PI - Math.Abs(value2) < 0.6f)
                    {
                        value = _mouthColor;
                    }
                    vector2 = Vector4.Lerp(vector2, value, amount);
                }
                if (flag && gridPositionOfIndex.Y == 3 && canvasPositionOfIndex.X > vector.X)
                {
                    float value3 = 1f - Math.Abs(canvasPositionOfIndex.X - vector.X * 2f - 0.5f) / 0.5f;
                    vector2 = Vector4.Lerp(vector2, _laserColor, MathHelper.Clamp(value3, 0f, 1f));
                }
                else if (!flag)
                {
                    Vector2 vector4 = canvasPositionOfIndex - (vector - new Vector2(1.2f, 0f));
                    vector4.Y *= 3.5f;
                    float num4 = vector4.Length();
                    if (num4 < 0.7f)
                    {
                        float dynamicNoise = NoiseHelper.GetDynamicNoise(canvasPositionOfIndex, time);
                        dynamicNoise  = dynamicNoise * dynamicNoise * dynamicNoise;
                        dynamicNoise *= 1f - MathHelper.Clamp((num4 - 0.7f + 0.3f) / 0.3f, 0f, 1f);
                        vector2       = Vector4.Lerp(vector2, _flameColor, dynamicNoise);
                    }
                }
                fragment.SetColor(i, vector2);
            }
        }
Пример #3
0
 private void ProcessHighDetail(
     RgbDevice device,
     Fragment fragment,
     EffectDetailLevel quality,
     float time)
 {
     if (device.Type != null && (int)device.Type != 6)
     {
         this.ProcessLowDetail(device, fragment, quality, time);
     }
     else
     {
         bool  flag = true;
         float num1 = (float)((double)time * 0.100000001490116 % 2.0);
         if ((double)num1 > 1.0)
         {
             num1 = 2f - num1;
             flag = false;
         }
         Vector2 vector2_1 = new Vector2((float)((double)num1 * 7.0 - 3.5), 0.0f) + fragment.CanvasCenter;
         for (int index = 0; index < fragment.Count; ++index)
         {
             Vector2 canvasPositionOfIndex = fragment.GetCanvasPositionOfIndex(index);
             Point   gridPositionOfIndex   = fragment.GetGridPositionOfIndex(index);
             Vector4 vector4_1             = this._backgroundColor;
             Vector2 vector2_2             = canvasPositionOfIndex - vector2_1;
             float   num2 = vector2_2.Length();
             if ((double)num2 < 0.5)
             {
                 float amount1 = 1f - MathHelper.Clamp((float)(((double)num2 - 0.5 + 0.200000002980232) / 0.200000002980232), 0.0f, 1f);
                 float amount2 = MathHelper.Clamp((float)(((double)vector2_2.X + 0.5 - 0.200000002980232) / 0.600000023841858), 0.0f, 1f);
                 if (flag)
                 {
                     amount2 = 1f - amount2;
                 }
                 Vector4 vector4_2 = Vector4.Lerp(this._eyeColor, this._veinColor, amount2);
                 float   num3      = (float)Math.Atan2((double)vector2_2.Y, (double)vector2_2.X);
                 if (!flag && 3.14159274101257 - (double)Math.Abs(num3) < 0.600000023841858)
                 {
                     vector4_2 = this._mouthColor;
                 }
                 vector4_1 = Vector4.Lerp(vector4_1, vector4_2, amount1);
             }
             if (flag && gridPositionOfIndex.Y == 3 && (double)canvasPositionOfIndex.X > (double)vector2_1.X)
             {
                 float num3 = (float)(1.0 - (double)Math.Abs((float)((double)canvasPositionOfIndex.X - (double)vector2_1.X * 2.0 - 0.5)) / 0.5);
                 vector4_1 = Vector4.Lerp(vector4_1, this._laserColor, MathHelper.Clamp(num3, 0.0f, 1f));
             }
             else if (!flag)
             {
                 Vector2 vector2_3 = canvasPositionOfIndex - (vector2_1 - new Vector2(1.2f, 0.0f));
                 vector2_3.Y *= 3.5f;
                 float num3 = vector2_3.Length();
                 if ((double)num3 < 0.699999988079071)
                 {
                     float dynamicNoise = NoiseHelper.GetDynamicNoise(canvasPositionOfIndex, time);
                     float amount       = dynamicNoise * dynamicNoise * dynamicNoise * (1f - MathHelper.Clamp((float)(((double)num3 - 0.699999988079071 + 0.300000011920929) / 0.300000011920929), 0.0f, 1f));
                     vector4_1 = Vector4.Lerp(vector4_1, this._flameColor, amount);
                 }
             }
             fragment.SetColor(index, vector4_1);
         }
     }
 }