// Token: 0x060002B6 RID: 694 RVA: 0x00022580 File Offset: 0x00020780 public virtual 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((float)0, (float)0, (float)0, (float)0)); 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 * DepthOfField34.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); int i = 0; Mesh[] array = meshes; int length = array.Length; while (i < length) { if (array[i]) { Graphics.DrawMeshNow(array[i], Matrix4x4.identity); } i++; } GL.PopMatrix(); Graphics.Blit(tempTex, finalTarget, this.dofMaterial, 8); bokehInfo.filterMode = FilterMode.Bilinear; } }
public void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget) { if (!bokehMaterial) { return; } Mesh[] meshes = Quads.GetMeshes(tempTex.width, tempTex.height); RenderTexture.active = tempTex; GL.Clear(clearDepth: false, clearColor: 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 += bokehScale * maxBlurSpread * BOKEH_EXTRA_BLUR * oneOverBaseSize; bokehMaterial.SetTexture("_Source", bokehInfo); bokehMaterial.SetTexture("_MainTex", bokehTexture); bokehMaterial.SetVector("_ArScale", new Vector4(num2, num2 * num, 0.5f, 0.5f * num)); bokehMaterial.SetFloat("_Intensity", bokehIntensity); bokehMaterial.SetPass(0); int i = 0; Mesh[] array = meshes; for (int length = array.Length; i < length; i++) { if ((bool)array[i]) { Graphics.DrawMeshNow(array[i], Matrix4x4.identity); } } GL.PopMatrix(); Graphics.Blit(tempTex, finalTarget, dofMaterial, 8); bokehInfo.filterMode = FilterMode.Bilinear; }
void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget) { if (bokehMaterial) { Mesh[] meshes = Quads.GetMeshes(tempTex.width, tempTex.height); RenderTexture.active = tempTex; GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f)); GL.PushMatrix(); GL.LoadIdentity(); // important, otherwise we get bokeh shape & size artefacts bokehInfo.filterMode = FilterMode.Point; float arW = (bokehInfo.width * 1.0f) / (bokehInfo.height * 1.0f); //float sc = BOKEH_EXTRA_BLUR / bokehInfo.height + bokehScale * maxBlurSpread * BOKEH_EXTRA_BLUR * oneOverBaseSize; 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; } }