Example #1
0
        public override void PopulateCommandBuffer(CommandBuffer cb)
        {
            AmbientOcclusionModel.Settings settings = base.model.settings;
            Material mat       = base.context.materialFactory.Get("Hidden/Post FX/Blit");
            Material material2 = base.context.materialFactory.Get("Hidden/Post FX/Ambient Occlusion");

            material2.shaderKeywords = null;
            material2.SetFloat(Uniforms._Intensity, settings.intensity);
            material2.SetFloat(Uniforms._Radius, settings.radius);
            material2.SetFloat(Uniforms._Downsample, !settings.downsampling ? 1f : 0.5f);
            material2.SetInt(Uniforms._SampleCount, (int)settings.sampleCount);
            int width  = base.context.width;
            int height = base.context.height;
            int num3   = !settings.downsampling ? 1 : 2;
            int nameID = Uniforms._OcclusionTexture1;

            cb.GetTemporaryRT(nameID, width / num3, height / num3, 0, FilterMode.Bilinear, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            cb.Blit((Texture)null, nameID, material2, (int)this.occlusionSource);
            int num5 = Uniforms._OcclusionTexture2;

            cb.GetTemporaryRT(num5, width, height, 0, FilterMode.Bilinear, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            cb.SetGlobalTexture(Uniforms._MainTex, nameID);
            cb.Blit(nameID, num5, material2, (this.occlusionSource != OcclusionSource.GBuffer) ? 3 : 4);
            cb.ReleaseTemporaryRT(nameID);
            nameID = Uniforms._OcclusionTexture;
            cb.GetTemporaryRT(nameID, width, height, 0, FilterMode.Bilinear, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            cb.SetGlobalTexture(Uniforms._MainTex, num5);
            cb.Blit(num5, nameID, material2, 5);
            cb.ReleaseTemporaryRT(num5);
            if (base.context.profile.debugViews.IsModeActive(BuiltinDebugViewsModel.Mode.AmbientOcclusion))
            {
                cb.SetGlobalTexture(Uniforms._MainTex, nameID);
                cb.Blit(nameID, 2, material2, 8);
                base.context.Interrupt();
            }
            else if (this.ambientOnlySupported)
            {
                cb.SetRenderTarget(this.m_MRT, 2);
                cb.DrawMesh(GraphicsUtils.quad, Matrix4x4.identity, material2, 0, 7);
            }
            else
            {
                RenderTextureFormat format = !base.context.isHdr ? RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR;
                int num6 = Uniforms._TempRT;
                cb.GetTemporaryRT(num6, base.context.width, base.context.height, 0, FilterMode.Bilinear, format);
                cb.Blit(2, num6, mat, 0);
                cb.SetGlobalTexture(Uniforms._MainTex, num6);
                cb.Blit(num6, 2, material2, 6);
                cb.ReleaseTemporaryRT(num6);
            }
            cb.ReleaseTemporaryRT(nameID);
        }
Example #2
0
        public override void PopulateCommandBuffer(CommandBuffer cb)
        {
            AmbientOcclusionModel.Settings settings = base.model.settings;
            Material material  = this.context.materialFactory.Get("Hidden/Post FX/Blit");
            Material material2 = this.context.materialFactory.Get("Hidden/Post FX/Ambient Occlusion");

            material2.shaderKeywords = null;
            material2.SetFloat(AmbientOcclusionComponent.Uniforms._Intensity, settings.intensity);
            material2.SetFloat(AmbientOcclusionComponent.Uniforms._Radius, settings.radius);
            material2.SetFloat(AmbientOcclusionComponent.Uniforms._Downsample, (!settings.downsampling) ? 1f : 0.5f);
            material2.SetInt(AmbientOcclusionComponent.Uniforms._SampleCount, (int)settings.sampleCount);
            int width  = this.context.width;
            int height = this.context.height;
            int num    = (!settings.downsampling) ? 1 : 2;
            int num2   = AmbientOcclusionComponent.Uniforms._OcclusionTexture1;

            cb.GetTemporaryRT(num2, width / num, height / num, 0, 1, 0, 1);
            cb.Blit(null, num2, material2, (int)this.occlusionSource);
            int occlusionTexture = AmbientOcclusionComponent.Uniforms._OcclusionTexture2;

            cb.GetTemporaryRT(occlusionTexture, width, height, 0, 1, 0, 1);
            cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, num2);
            cb.Blit(num2, occlusionTexture, material2, (this.occlusionSource != AmbientOcclusionComponent.OcclusionSource.GBuffer) ? 3 : 4);
            cb.ReleaseTemporaryRT(num2);
            num2 = AmbientOcclusionComponent.Uniforms._OcclusionTexture;
            cb.GetTemporaryRT(num2, width, height, 0, 1, 0, 1);
            cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, occlusionTexture);
            cb.Blit(occlusionTexture, num2, material2, 5);
            cb.ReleaseTemporaryRT(occlusionTexture);
            if (this.context.profile.debugViews.IsModeActive(BuiltinDebugViewsModel.Mode.AmbientOcclusion))
            {
                cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, num2);
                cb.Blit(num2, 2, material2, 8);
                this.context.Interrupt();
            }
            else if (this.ambientOnlySupported)
            {
                cb.SetRenderTarget(this.m_MRT, 2);
                cb.DrawMesh(GraphicsUtils.quad, Matrix4x4.identity, material2, 0, 7);
            }
            else
            {
                RenderTextureFormat renderTextureFormat = (!this.context.isHdr) ? 7 : 9;
                int tempRT = AmbientOcclusionComponent.Uniforms._TempRT;
                cb.GetTemporaryRT(tempRT, this.context.width, this.context.height, 0, 1, renderTextureFormat);
                cb.Blit(2, tempRT, material, 0);
                cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, tempRT);
                cb.Blit(tempRT, 2, material2, 6);
                cb.ReleaseTemporaryRT(tempRT);
            }
            cb.ReleaseTemporaryRT(num2);
        }
Example #3
0
 // Token: 0x0600642B RID: 25643 RVA: 0x000270DC File Offset: 0x000252DC
 public void GQEOEDENQNF(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #4
0
 // Token: 0x06006429 RID: 25641 RVA: 0x000270DC File Offset: 0x000252DC
 public void DGLGPOBMNLQ(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #5
0
 // Token: 0x0600644B RID: 25675 RVA: 0x000270DC File Offset: 0x000252DC
 public void OONCJCLHBKC(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #6
0
 // Token: 0x0600644A RID: 25674 RVA: 0x000270DC File Offset: 0x000252DC
 public void FBHPICJCHLD(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #7
0
 // Token: 0x06006433 RID: 25651 RVA: 0x000270DC File Offset: 0x000252DC
 public void FPPMCMPJPLF(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #8
0
 // Token: 0x06006431 RID: 25649 RVA: 0x000270DC File Offset: 0x000252DC
 public void OLNBCBOIFPH(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #9
0
 // Token: 0x06006442 RID: 25666 RVA: 0x000270DC File Offset: 0x000252DC
 public void CKEBGJBCHHE(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #10
0
 // Token: 0x06006440 RID: 25664 RVA: 0x000270DC File Offset: 0x000252DC
 public void JOHIKMKJLBL(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #11
0
 // Token: 0x0600643D RID: 25661 RVA: 0x000270DC File Offset: 0x000252DC
 public void CEOMMEOIBJE(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #12
0
 // Token: 0x0600643C RID: 25660 RVA: 0x000270DC File Offset: 0x000252DC
 public void FNICHKLMFJN(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #13
0
 // Token: 0x06006437 RID: 25655 RVA: 0x000270DC File Offset: 0x000252DC
 public void JCOMDFJMFFK(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #14
0
 // Token: 0x06006436 RID: 25654 RVA: 0x000270DC File Offset: 0x000252DC
 public void IFDQONCQDKD(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #15
0
 // Token: 0x0600642F RID: 25647 RVA: 0x000270DC File Offset: 0x000252DC
 public void PHHLFINPGIG(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #16
0
 // Token: 0x06006430 RID: 25648 RVA: 0x000270DC File Offset: 0x000252DC
 public void HJDODIPCIGF(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #17
0
 // Token: 0x06006444 RID: 25668 RVA: 0x000270DC File Offset: 0x000252DC
 public void PJBNMNINPCP(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #18
0
 // Token: 0x06006425 RID: 25637 RVA: 0x000270DC File Offset: 0x000252DC
 public void EDEGJLKIJED(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #19
0
 // Token: 0x06006446 RID: 25670 RVA: 0x000270DC File Offset: 0x000252DC
 public void KMDFEEPLPIH(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
Example #20
0
        public override void PopulateCommandBuffer(CommandBuffer cb)
        {
            AmbientOcclusionModel.Settings settings = base.model.settings;
            Material mat      = this.context.materialFactory.Get("Hidden/Post FX/Blit");
            Material material = this.context.materialFactory.Get("Hidden/Post FX/Ambient Occlusion");

            material.shaderKeywords = null;
            material.SetFloat(AmbientOcclusionComponent.Uniforms._Intensity, settings.intensity);
            material.SetFloat(AmbientOcclusionComponent.Uniforms._Radius, settings.radius);
            material.SetFloat(AmbientOcclusionComponent.Uniforms._Downsample, (!settings.downsampling) ? 1f : 0.5f);
            material.SetInt(AmbientOcclusionComponent.Uniforms._SampleCount, (int)settings.sampleCount);
            if (!this.context.isGBufferAvailable && RenderSettings.fog)
            {
                material.SetVector(AmbientOcclusionComponent.Uniforms._FogParams, new Vector3(RenderSettings.fogDensity, RenderSettings.fogStartDistance, RenderSettings.fogEndDistance));
                FogMode fogMode = RenderSettings.fogMode;
                if (fogMode != FogMode.Linear)
                {
                    if (fogMode != FogMode.Exponential)
                    {
                        if (fogMode == FogMode.ExponentialSquared)
                        {
                            material.EnableKeyword("FOG_EXP2");
                        }
                    }
                    else
                    {
                        material.EnableKeyword("FOG_EXP");
                    }
                }
                else
                {
                    material.EnableKeyword("FOG_LINEAR");
                }
            }
            else
            {
                material.EnableKeyword("FOG_OFF");
            }
            int width  = this.context.width;
            int height = this.context.height;
            int num    = (!settings.downsampling) ? 1 : 2;
            int nameID = AmbientOcclusionComponent.Uniforms._OcclusionTexture1;

            cb.GetTemporaryRT(nameID, width / num, height / num, 0, FilterMode.Bilinear, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            cb.Blit(null, nameID, material, (int)this.occlusionSource);
            int occlusionTexture = AmbientOcclusionComponent.Uniforms._OcclusionTexture2;

            cb.GetTemporaryRT(occlusionTexture, width, height, 0, FilterMode.Bilinear, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, nameID);
            cb.Blit(nameID, occlusionTexture, material, (this.occlusionSource != AmbientOcclusionComponent.OcclusionSource.GBuffer) ? 3 : 4);
            cb.ReleaseTemporaryRT(nameID);
            nameID = AmbientOcclusionComponent.Uniforms._OcclusionTexture;
            cb.GetTemporaryRT(nameID, width, height, 0, FilterMode.Bilinear, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
            cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, occlusionTexture);
            cb.Blit(occlusionTexture, nameID, material, 5);
            cb.ReleaseTemporaryRT(occlusionTexture);
            if (this.context.profile.debugViews.IsModeActive(BuiltinDebugViewsModel.Mode.AmbientOcclusion))
            {
                cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, nameID);
                cb.Blit(nameID, BuiltinRenderTextureType.CameraTarget, material, 8);
                this.context.Interrupt();
            }
            else if (this.ambientOnlySupported)
            {
                cb.SetRenderTarget(this.m_MRT, BuiltinRenderTextureType.CameraTarget);
                cb.DrawMesh(GraphicsUtils.quad, Matrix4x4.identity, material, 0, 7);
            }
            else
            {
                RenderTextureFormat format = (!this.context.isHdr) ? RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR;
                int tempRT = AmbientOcclusionComponent.Uniforms._TempRT;
                cb.GetTemporaryRT(tempRT, this.context.width, this.context.height, 0, FilterMode.Bilinear, format);
                cb.Blit(BuiltinRenderTextureType.CameraTarget, tempRT, mat, 0);
                cb.SetGlobalTexture(AmbientOcclusionComponent.Uniforms._MainTex, tempRT);
                cb.Blit(tempRT, BuiltinRenderTextureType.CameraTarget, material, 6);
                cb.ReleaseTemporaryRT(tempRT);
            }
            cb.ReleaseTemporaryRT(nameID);
        }
Example #21
0
 // Token: 0x06006447 RID: 25671 RVA: 0x000270DC File Offset: 0x000252DC
 public void KBQJHMQODPF(AmbientOcclusionModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }