private void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget)
 {
     if (this.bokehMaterial)
     {
         Mesh[] meshes = Quads.GetMeshes(tempTex.width, tempTex.height);
         RenderTexture.active = tempTex;
         GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
         GL.PushMatrix();
         GL.LoadIdentity();
         bokehInfo.filterMode = FilterMode.Point;
         float num  = (float)bokehInfo.width * 1f / ((float)bokehInfo.height * 1f);
         float num2 = 2f / (1f * (float)bokehInfo.width);
         num2 += this.bokehScale * this.maxBlurSpread * DepthOfFieldDeprecated.BOKEH_EXTRA_BLUR * this.oneOverBaseSize;
         this.bokehMaterial.SetTexture("_Source", bokehInfo);
         this.bokehMaterial.SetTexture("_MainTex", this.bokehTexture);
         this.bokehMaterial.SetVector("_ArScale", new Vector4(num2, num2 * num, 0.5f, 0.5f * num));
         this.bokehMaterial.SetFloat("_Intensity", this.bokehIntensity);
         this.bokehMaterial.SetPass(0);
         foreach (Mesh mesh in meshes)
         {
             if (mesh)
             {
                 Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
             }
         }
         GL.PopMatrix();
         Graphics.Blit(tempTex, finalTarget, this.dofMaterial, 8);
         bokehInfo.filterMode = FilterMode.Bilinear;
     }
 }
        void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget)
        {
            if (bokehMaterial)
            {
                var meshes = Quads.GetMeshes(tempTex.width, tempTex.height);    // quads: exchanging more triangles with less overdraw

                RenderTexture.active = tempTex;
                GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));

                GL.PushMatrix();
                GL.LoadIdentity();

                // point filter mode is important, otherwise we get bokeh shape & size artefacts
                bokehInfo.filterMode = FilterMode.Point;

                float arW = (bokehInfo.width * 1.0f) / (bokehInfo.height * 1.0f);
                float sc  = 2.0f / (1.0f * bokehInfo.width);
                sc += bokehScale * maxBlurSpread * BOKEH_EXTRA_BLUR * oneOverBaseSize;

                bokehMaterial.SetTexture("_Source", bokehInfo);
                bokehMaterial.SetTexture("_MainTex", bokehTexture);
                bokehMaterial.SetVector("_ArScale", new Vector4(sc, sc * arW, 0.5f, 0.5f * arW));
                bokehMaterial.SetFloat("_Intensity", bokehIntensity);
                bokehMaterial.SetPass(0);

                foreach (Mesh m in meshes)
                {
                    if (m)
                    {
                        Graphics.DrawMeshNow(m, Matrix4x4.identity);
                    }
                }

                GL.PopMatrix();

                Graphics.Blit(tempTex, finalTarget, dofMaterial, 8);

                // important to set back as we sample from this later on
                bokehInfo.filterMode = FilterMode.Bilinear;
            }
        }
 private void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget)
 {
     if (this.bokehMaterial)
     {
         Mesh[] meshes = Quads.GetMeshes(tempTex.width, tempTex.height);
         RenderTexture.active = tempTex;
         GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
         GL.PushMatrix();
         GL.LoadIdentity();
         bokehInfo.filterMode = FilterMode.Point;
         float num = (bokehInfo.width * 1f) / (bokehInfo.height * 1f);
         float x = (2f / (1f * bokehInfo.width)) + (((this.bokehScale * this.maxBlurSpread) * BOKEH_EXTRA_BLUR) * this.oneOverBaseSize);
         this.bokehMaterial.SetTexture("_Source", bokehInfo);
         this.bokehMaterial.SetTexture("_MainTex", this.bokehTexture);
         this.bokehMaterial.SetVector("_ArScale", new Vector4(x, x * num, 0.5f, 0.5f * num));
         this.bokehMaterial.SetFloat("_Intensity", this.bokehIntensity);
         this.bokehMaterial.SetPass(0);
         Mesh[] meshArray2 = meshes;
         int index = 0;
         while (true)
         {
             if (index >= meshArray2.Length)
             {
                 GL.PopMatrix();
                 Graphics.Blit(tempTex, finalTarget, this.dofMaterial, 8);
                 bokehInfo.filterMode = FilterMode.Bilinear;
                 break;
             }
             Mesh mesh = meshArray2[index];
             if (mesh)
             {
                 Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
             }
             index++;
         }
     }
 }