示例#1
0
        private Vector4 GetHistogramScaleOffsetRes()
        {
            EyeAdaptationModel.Settings settings = base.model.settings;
            float x = 1f / ((float)(settings.logMax - settings.logMin));

            return(new Vector4(x, -settings.logMin * x, Mathf.Floor(((float)base.context.width) / 2f), Mathf.Floor(((float)base.context.height) / 2f)));
        }
        private Vector4 GetHistogramScaleOffsetRes()
        {
            EyeAdaptationModel.Settings settings = base.model.settings;
            float num  = (float)(settings.logMax - settings.logMin);
            float num2 = 1f / num;
            float y    = (float)(-(float)settings.logMin) * num2;

            return(new Vector4(num2, y, Mathf.Floor((float)this.context.width / 2f), Mathf.Floor((float)this.context.height / 2f)));
        }
示例#3
0
 // Token: 0x0600680E RID: 26638 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void HJDODIPCIGF(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#4
0
 // Token: 0x0600680C RID: 26636 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void KMDFEEPLPIH(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#5
0
 // Token: 0x06006809 RID: 26633 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void FPPMCMPJPLF(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#6
0
 // Token: 0x060067E5 RID: 26597 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void BBKQJEJLHJL(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#7
0
 // Token: 0x060067E7 RID: 26599 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void BIIDDQIJKLC(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#8
0
 // Token: 0x060067F8 RID: 26616 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void EODOLDLQKFF(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#9
0
 // Token: 0x060067DB RID: 26587 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void CJFBEEEEGPQ(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#10
0
 // Token: 0x060067F4 RID: 26612 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void PJBNMNINPCP(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#11
0
 // Token: 0x060067F6 RID: 26614 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void JCOMDFJMFFK(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#12
0
 // Token: 0x060067F1 RID: 26609 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void HMHGDNBBPBP(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#13
0
 // Token: 0x060067ED RID: 26605 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void DNJDLBGKLDC(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#14
0
 // Token: 0x060067EC RID: 26604 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void IQDEILBBNEE(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#15
0
 // Token: 0x060067E0 RID: 26592 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void BFQKOICKIQG(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#16
0
 // Token: 0x060067FE RID: 26622 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void LEMOMMDPLKK(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#17
0
 // Token: 0x060067E3 RID: 26595 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void QDBINMDOHOM(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#18
0
 // Token: 0x06006801 RID: 26625 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void QLJBOOEHKFN(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#19
0
 // Token: 0x060067E6 RID: 26598 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void NEBHFCDDQGL(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#20
0
 // Token: 0x06006802 RID: 26626 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void FIHCDJGMDOJ(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#21
0
 // Token: 0x060067E8 RID: 26600 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void DGGHCNKLLKF(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
示例#22
0
 // Token: 0x06006805 RID: 26629 RVA: 0x000279A2 File Offset: 0x00025BA2
 public void IFCNCMMGCFN(EyeAdaptationModel.Settings BGBMIEJJQKC)
 {
     this.m_Settings = BGBMIEJJQKC;
 }
        public Texture Prepare(RenderTexture source, Material uberMaterial)
        {
            EyeAdaptationModel.Settings settings = base.model.settings;
            if (this.m_EyeCompute == null)
            {
                this.m_EyeCompute = Resources.Load <ComputeShader>("Shaders/EyeHistogram");
            }
            Material material = this.context.materialFactory.Get("Hidden/Post FX/Eye Adaptation");

            material.shaderKeywords = null;
            if (this.m_HistogramBuffer == null)
            {
                this.m_HistogramBuffer = new ComputeBuffer(64, 4);
            }
            if (EyeAdaptationComponent.s_EmptyHistogramBuffer == null)
            {
                EyeAdaptationComponent.s_EmptyHistogramBuffer = new uint[64];
            }
            Vector4       histogramScaleOffsetRes = this.GetHistogramScaleOffsetRes();
            RenderTexture renderTexture           = this.context.renderTextureFactory.Get((int)histogramScaleOffsetRes.z, (int)histogramScaleOffsetRes.w, 0, source.format, RenderTextureReadWrite.Default, FilterMode.Bilinear, TextureWrapMode.Clamp, "FactoryTempTexture");

            Graphics.Blit(source, renderTexture);
            if (this.m_AutoExposurePool[0] == null || !this.m_AutoExposurePool[0].IsCreated())
            {
                this.m_AutoExposurePool[0] = new RenderTexture(1, 1, 0, RenderTextureFormat.RFloat);
            }
            if (this.m_AutoExposurePool[1] == null || !this.m_AutoExposurePool[1].IsCreated())
            {
                this.m_AutoExposurePool[1] = new RenderTexture(1, 1, 0, RenderTextureFormat.RFloat);
            }
            this.m_HistogramBuffer.SetData(EyeAdaptationComponent.s_EmptyHistogramBuffer);
            int kernelIndex = this.m_EyeCompute.FindKernel("KEyeHistogram");

            this.m_EyeCompute.SetBuffer(kernelIndex, "_Histogram", this.m_HistogramBuffer);
            this.m_EyeCompute.SetTexture(kernelIndex, "_Source", renderTexture);
            this.m_EyeCompute.SetVector("_ScaleOffsetRes", histogramScaleOffsetRes);
            this.m_EyeCompute.Dispatch(kernelIndex, Mathf.CeilToInt((float)renderTexture.width / 16f), Mathf.CeilToInt((float)renderTexture.height / 16f), 1);
            this.context.renderTextureFactory.Release(renderTexture);
            settings.highPercent = Mathf.Clamp(settings.highPercent, 1.01f, 99f);
            settings.lowPercent  = Mathf.Clamp(settings.lowPercent, 1f, settings.highPercent - 0.01f);
            material.SetBuffer("_Histogram", this.m_HistogramBuffer);
            material.SetVector(EyeAdaptationComponent.Uniforms._Params, new Vector4(settings.lowPercent * 0.01f, settings.highPercent * 0.01f, Mathf.Exp(settings.minLuminance * 0.6931472f), Mathf.Exp(settings.maxLuminance * 0.6931472f)));
            material.SetVector(EyeAdaptationComponent.Uniforms._Speed, new Vector2(settings.speedDown, settings.speedUp));
            material.SetVector(EyeAdaptationComponent.Uniforms._ScaleOffsetRes, histogramScaleOffsetRes);
            material.SetFloat(EyeAdaptationComponent.Uniforms._ExposureCompensation, settings.keyValue);
            if (settings.dynamicKeyValue)
            {
                material.EnableKeyword("AUTO_KEY_VALUE");
            }
            if (this.m_FirstFrame || !Application.isPlaying)
            {
                this.m_CurrentAutoExposure = this.m_AutoExposurePool[0];
                Graphics.Blit(null, this.m_CurrentAutoExposure, material, 1);
                Graphics.Blit(this.m_AutoExposurePool[0], this.m_AutoExposurePool[1]);
            }
            else
            {
                int           num            = this.m_AutoExposurePingPing;
                Texture       source2        = this.m_AutoExposurePool[++num % 2];
                RenderTexture renderTexture2 = this.m_AutoExposurePool[++num % 2];
                Graphics.Blit(source2, renderTexture2, material, (int)settings.adaptationType);
                this.m_AutoExposurePingPing = (num + 1) % 2;
                this.m_CurrentAutoExposure  = renderTexture2;
            }
            if (this.context.profile.debugViews.IsModeActive(BuiltinDebugViewsModel.Mode.EyeAdaptation))
            {
                if (this.m_DebugHistogram == null || !this.m_DebugHistogram.IsCreated())
                {
                    this.m_DebugHistogram = new RenderTexture(256, 128, 0, RenderTextureFormat.ARGB32)
                    {
                        filterMode = FilterMode.Point,
                        wrapMode   = TextureWrapMode.Clamp
                    };
                }
                material.SetFloat(EyeAdaptationComponent.Uniforms._DebugWidth, (float)this.m_DebugHistogram.width);
                Graphics.Blit(null, this.m_DebugHistogram, material, 2);
            }
            this.m_FirstFrame = false;
            return(this.m_CurrentAutoExposure);
        }
        public Texture Prepare(RenderTexture source, Material uberMaterial)
        {
            EyeAdaptationModel.Settings settings = base.model.settings;
            if (this.m_EyeCompute == null)
            {
                this.m_EyeCompute = Resources.Load <ComputeShader>("Shaders/EyeHistogram");
            }
            Material material = this.context.materialFactory.Get("Hidden/Post FX/Eye Adaptation");

            if (this.m_HistogramBuffer == null)
            {
                this.m_HistogramBuffer = new ComputeBuffer(64, 4);
            }
            if (EyeAdaptationComponent.s_EmptyHistogramBuffer == null)
            {
                EyeAdaptationComponent.s_EmptyHistogramBuffer = new uint[64];
            }
            Vector4       histogramScaleOffsetRes = this.GetHistogramScaleOffsetRes();
            RenderTexture renderTexture           = this.context.renderTextureFactory.Get((int)histogramScaleOffsetRes.z, (int)histogramScaleOffsetRes.w, 0, source.format, 0, 1, 1, "FactoryTempTexture");

            Graphics.Blit(source, renderTexture);
            if (this.m_AutoExposurePool[0] == null || !this.m_AutoExposurePool[0].IsCreated())
            {
                this.m_AutoExposurePool[0] = new RenderTexture(1, 1, 0, 14);
            }
            if (this.m_AutoExposurePool[1] == null || !this.m_AutoExposurePool[1].IsCreated())
            {
                this.m_AutoExposurePool[1] = new RenderTexture(1, 1, 0, 14);
            }
            this.m_HistogramBuffer.SetData(EyeAdaptationComponent.s_EmptyHistogramBuffer);
            int num = this.m_EyeCompute.FindKernel("KEyeHistogram");

            this.m_EyeCompute.SetBuffer(num, "_Histogram", this.m_HistogramBuffer);
            this.m_EyeCompute.SetTexture(num, "_Source", renderTexture);
            this.m_EyeCompute.SetVector("_ScaleOffsetRes", histogramScaleOffsetRes);
            this.m_EyeCompute.Dispatch(num, Mathf.CeilToInt((float)renderTexture.width / 16f), Mathf.CeilToInt((float)renderTexture.height / 16f), 1);
            this.context.renderTextureFactory.Release(renderTexture);
            settings.highPercent = Mathf.Clamp(settings.highPercent, 1.01f, 99f);
            settings.lowPercent  = Mathf.Clamp(settings.lowPercent, 1f, settings.highPercent - 0.01f);
            material.SetBuffer("_Histogram", this.m_HistogramBuffer);
            material.SetVector(EyeAdaptationComponent.Uniforms._Params, new Vector4(settings.lowPercent * 0.01f, settings.highPercent * 0.01f, settings.minLuminance, settings.maxLuminance));
            material.SetVector(EyeAdaptationComponent.Uniforms._Speed, new Vector2(settings.speedDown, settings.speedUp));
            material.SetVector(EyeAdaptationComponent.Uniforms._ScaleOffsetRes, histogramScaleOffsetRes);
            material.SetFloat(EyeAdaptationComponent.Uniforms._ExposureCompensation, settings.exposureCompensation);
            if (this.m_FirstFrame || !Application.isPlaying)
            {
                this.m_CurrentAutoExposure = this.m_AutoExposurePool[0];
                Graphics.Blit(null, this.m_CurrentAutoExposure, material, 1);
                Graphics.Blit(this.m_AutoExposurePool[0], this.m_AutoExposurePool[1]);
            }
            else
            {
                int           num2           = this.m_AutoExposurePingPing;
                RenderTexture renderTexture2 = this.m_AutoExposurePool[++num2 % 2];
                RenderTexture renderTexture3 = this.m_AutoExposurePool[++num2 % 2];
                Graphics.Blit(renderTexture2, renderTexture3, material, (int)settings.adaptationType);
                this.m_AutoExposurePingPing = (num2 + 1) % 2;
                this.m_CurrentAutoExposure  = renderTexture3;
            }
            uberMaterial.EnableKeyword("EYE_ADAPTATION");
            uberMaterial.SetTexture(EyeAdaptationComponent.Uniforms._AutoExposure, this.m_CurrentAutoExposure);
            if (this.context.profile.debugViews.IsModeActive(BuiltinDebugViewsModel.Mode.EyeAdaptation))
            {
                if (this.m_DebugHistogram == null || !this.m_DebugHistogram.IsCreated())
                {
                    this.m_DebugHistogram = new RenderTexture(256, 128, 0, 0)
                    {
                        filterMode = 0,
                        wrapMode   = 1
                    };
                }
                material.SetFloat(EyeAdaptationComponent.Uniforms._DebugWidth, (float)this.m_DebugHistogram.width);
                Graphics.Blit(null, this.m_DebugHistogram, material, 2);
            }
            this.m_FirstFrame = false;
            return(this.m_CurrentAutoExposure);
        }