コード例 #1
0
    private void Update()
    {
        if (this.postProcessingProfile)
        {
            ColorGradingModel.Settings settings = this.postProcessingProfile.colorGrading.settings;
            float num      = PlayerPreferences.GammaWorldAndDay;
            float contrast = PlayerPreferences.Contrast;
            if (Clock.Dark || LocalPlayer.IsInCaves)
            {
                num = PlayerPreferences.GammaCavesAndNight;
            }
            bool flag = LocalPlayer.Inventory != null && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.Pause;
            if (flag || float.IsNaN(settings.basic.postExposure) || float.IsInfinity(settings.basic.postExposure) || Mathf.Abs(num - settings.basic.postExposure) < 0.001f)
            {
                if (!settings.basic.postExposure.Equals(num))
                {
                    settings.basic.postExposure = num;
                }
            }
            else
            {
                settings.basic.postExposure = Mathf.SmoothDamp(settings.basic.postExposure, num, ref this.gammaVelocity, 3f);
            }
            if (flag || float.IsNaN(settings.basic.contrast) || float.IsInfinity(settings.basic.contrast) || Mathf.Abs(contrast - settings.basic.contrast) < 0.001f)
            {
                if (!settings.basic.contrast.Equals(contrast))
                {
                    settings.basic.contrast = contrast;
                }
            }
            else
            {
                settings.basic.contrast = Mathf.SmoothDamp(settings.basic.contrast, contrast, ref this.contrastVelocity, 1f);
            }
            this.postProcessingProfile.colorGrading.settings = settings;
        }
        if (this.farShadowCascade)
        {
            bool flag2 = TheForestQualitySettings.UserSettings.FarShadowMode == TheForestQualitySettings.FarShadowModes.On && !LocalPlayer.IsInClosedArea;
            if (this.farShadowCascade.enableFarShadows != flag2)
            {
                this.farShadowCascade.enableFarShadows = flag2;
            }
        }
        if (this.postProcessingProfile && PlayerPreferences.ColorGrading >= 0 && PlayerPreferences.ColorGrading < this.AmplifyColorGradients.Length)
        {
            this.postProcessingProfile.userLut.enabled = true;
            UserLutModel.Settings settings2 = this.postProcessingProfile.userLut.settings;
            settings2.lut = this.AmplifyColorGradients[PlayerPreferences.ColorGrading];
            this.postProcessingProfile.userLut.settings = settings2;
        }
        if (this.frostEffect)
        {
            this.frostEffect.enabled = (this.frostEffect.coverage > 0f);
        }
        if (this.bleedEffect)
        {
            if (Application.isPlaying)
            {
                this.bleedEffect.enabled = (BleedBehavior.BloodAmount > 0f);
            }
            else
            {
                this.bleedEffect.enabled = (this.bleedEffect.TestingBloodAmount > 0f);
            }
        }
        TheForestQualitySettings.AntiAliasingTechnique antiAliasingTechnique = TheForestQualitySettings.UserSettings.AntiAliasing;
        if (SystemInfo.systemMemorySize <= 4096 || PlayerPreferences.LowMemoryMode)
        {
            antiAliasingTechnique = TheForestQualitySettings.AntiAliasingTechnique.None;
        }
        if (this.postProcessingProfile)
        {
            bool flag3 = !ForestVR.Enabled && antiAliasingTechnique != TheForestQualitySettings.AntiAliasingTechnique.None;
            this.postProcessingProfile.antialiasing.enabled = flag3;
            if (flag3)
            {
                AntialiasingModel.Settings settings3 = this.postProcessingProfile.antialiasing.settings;
                if (antiAliasingTechnique != TheForestQualitySettings.AntiAliasingTechnique.FXAA)
                {
                    if (antiAliasingTechnique == TheForestQualitySettings.AntiAliasingTechnique.TAA)
                    {
                        settings3.method = AntialiasingModel.Method.Taa;
                    }
                }
                else
                {
                    settings3.method = AntialiasingModel.Method.Fxaa;
                }
                this.postProcessingProfile.antialiasing.settings = settings3;
            }
        }
        if (this.postProcessingProfile)
        {
            bool flag4 = !ForestVR.Enabled && !this.SkipMotionBlur && TheForestQualitySettings.UserSettings.MotionBlur != TheForestQualitySettings.MotionBlurQuality.None;
            this.postProcessingProfile.motionBlur.enabled = flag4;
            if (flag4)
            {
                MotionBlurModel.Settings settings4 = this.postProcessingProfile.motionBlur.settings;
                switch (TheForestQualitySettings.UserSettings.MotionBlur)
                {
                case TheForestQualitySettings.MotionBlurQuality.Low:
                    settings4.sampleCount = 4;
                    break;

                case TheForestQualitySettings.MotionBlurQuality.Medium:
                    settings4.sampleCount = 8;
                    break;

                case TheForestQualitySettings.MotionBlurQuality.High:
                    settings4.sampleCount = 16;
                    break;

                case TheForestQualitySettings.MotionBlurQuality.Ultra:
                    settings4.sampleCount = 32;
                    break;
                }
                this.postProcessingProfile.motionBlur.settings = settings4;
            }
        }
        if (this.postProcessingProfile)
        {
            bool flag5 = !ForestVR.Enabled && TheForestQualitySettings.UserSettings.screenSpaceReflection == TheForestQualitySettings.ScreenSpaceReflection.On;
            flag5 = (flag5 && LocalPlayer.IsInEndgame);
            this.postProcessingProfile.screenSpaceReflection.enabled = flag5;
        }
        if (this.postProcessingProfile)
        {
        }
        if (this.postProcessingProfile)
        {
            bool enabled = !ForestVR.Enabled && TheForestQualitySettings.UserSettings.Fg == TheForestQualitySettings.FilmGrain.Normal;
            this.postProcessingProfile.grain.enabled = enabled;
        }
        if (this.postProcessingProfile)
        {
            bool enabled2 = TheForestQualitySettings.UserSettings.CA == TheForestQualitySettings.ChromaticAberration.Normal;
            this.postProcessingProfile.chromaticAberration.enabled = enabled2;
        }
        if (this.postProcessingProfile)
        {
            bool enabled3 = TheForestQualitySettings.UserSettings.SEBloom == TheForestQualitySettings.SEBloomTechnique.Normal;
            this.postProcessingProfile.bloom.enabled = enabled3;
        }
        if (Application.isPlaying)
        {
            if (!this.SunshineAtmosCam)
            {
                this.SunshineAtmosCam = base.GetComponent <TheForestAtmosphereCamera>();
                if (!this.SunshineAtmosCam)
                {
                    this.SunshineAtmosCam = base.gameObject.AddComponent <TheForestAtmosphereCamera>();
                }
            }
            this.SunshineCam.enabled = true;
            this.SunshinePP.enabled  = true;
            if (Sunshine.Instance)
            {
                Sunshine.Instance.enabled                = true;
                Sunshine.Instance.ScatterResolution      = TheForestQualitySettings.UserSettings.ScatterResolution;
                Sunshine.Instance.ScatterSamplingQuality = TheForestQualitySettings.UserSettings.ScatterSamplingQuality;
                if (this.SunshineOccluders.value != 0)
                {
                    bool flag6 = TheForestQualitySettings.UserSettings.SunshineOcclusion == TheForestQualitySettings.SunshineOcclusionOn.On || LocalPlayer.IsInCaves;
                    Sunshine.Instance.Occluders = ((!flag6) ? 0 : this.SunshineOccluders.value);
                }
                else
                {
                    this.SunshineOccluders = Sunshine.Instance.Occluders;
                }
            }
        }
        TheForestQualitySettings.SSAOTechnique ssaotechnique = TheForestQualitySettings.UserSettings.SSAO;
        if (SystemInfo.systemMemorySize <= 4096 || PlayerPreferences.LowMemoryMode)
        {
            ssaotechnique = TheForestQualitySettings.SSAOTechnique.Off;
        }
        if (this.amplifyOcclusion && (TheForestQualitySettings.UserSettings.SSAOType == TheForestQualitySettings.SSAOTypes.AMPLIFY || !this.postProcessingProfile))
        {
            this.amplifyOcclusion.enabled = (!ForestVR.Enabled && ssaotechnique != TheForestQualitySettings.SSAOTechnique.Off);
            if (this.postProcessingProfile)
            {
                this.postProcessingProfile.ambientOcclusion.enabled = false;
            }
            if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.Ultra)
            {
                if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.High)
                {
                    if (ssaotechnique == TheForestQualitySettings.SSAOTechnique.Low)
                    {
                        this.amplifyOcclusion.SampleCount = AmplifyOcclusionBase.SampleCountLevel.Low;
                    }
                }
                else
                {
                    this.amplifyOcclusion.SampleCount = AmplifyOcclusionBase.SampleCountLevel.Medium;
                }
            }
            else
            {
                this.amplifyOcclusion.SampleCount = AmplifyOcclusionBase.SampleCountLevel.High;
            }
        }
        else if (this.postProcessingProfile && (TheForestQualitySettings.UserSettings.SSAOType == TheForestQualitySettings.SSAOTypes.UNITY || !this.amplifyOcclusion))
        {
            this.postProcessingProfile.ambientOcclusion.enabled = (!ForestVR.Enabled && ssaotechnique != TheForestQualitySettings.SSAOTechnique.Off);
            if (this.amplifyOcclusion)
            {
                this.amplifyOcclusion.enabled = false;
            }
            AmbientOcclusionModel.Settings settings5 = this.postProcessingProfile.ambientOcclusion.settings;
            if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.Ultra)
            {
                if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.High)
                {
                    if (ssaotechnique == TheForestQualitySettings.SSAOTechnique.Low)
                    {
                        settings5.sampleCount = AmbientOcclusionModel.SampleCount.Lowest;
                    }
                }
                else
                {
                    settings5.sampleCount = AmbientOcclusionModel.SampleCount.Low;
                }
            }
            else
            {
                settings5.sampleCount = AmbientOcclusionModel.SampleCount.Medium;
            }
            this.postProcessingProfile.ambientOcclusion.settings = settings5;
        }
        if (LocalPlayer.WaterEngine)
        {
            if (LocalPlayer.IsInClosedArea)
            {
                Scene.OceanFlat.SetActive(false);
                Scene.OceanCeto.SetActive(false);
                this.CurrentOceanQuality = (TheForestQualitySettings.OceanQualities)(-1);
            }
            else if (TheForestQualitySettings.UserSettings.OceanQuality != this.CurrentOceanQuality)
            {
                this.CurrentOceanQuality = ((!PlayerPreferences.is32bit) ? TheForestQualitySettings.UserSettings.OceanQuality : TheForestQualitySettings.OceanQualities.Flat);
                TheForestQualitySettings.OceanQualities oceanQuality = TheForestQualitySettings.UserSettings.OceanQuality;
                if (oceanQuality != TheForestQualitySettings.OceanQualities.WaveDisplacementHigh)
                {
                    if (oceanQuality != TheForestQualitySettings.OceanQualities.WaveDisplacementLow)
                    {
                        if (oceanQuality == TheForestQualitySettings.OceanQualities.Flat)
                        {
                            Scene.OceanFlat.SetActive(true);
                            Scene.OceanCeto.SetActive(false);
                            this.waterBlurCeto.enabled = false;
                        }
                    }
                    else
                    {
                        Scene.OceanFlat.SetActive(false);
                        Scene.OceanCeto.SetActive(true);
                        this.waterBlurCeto.enabled = true;
                        if (OceanQualitySettings.Instance != null)
                        {
                            OceanQualitySettings.Instance.QualityChanged(CETO_QUALITY_SETTING.LOW);
                        }
                    }
                }
                else
                {
                    Scene.OceanFlat.SetActive(false);
                    Scene.OceanCeto.SetActive(true);
                    this.waterBlurCeto.enabled = true;
                    if (OceanQualitySettings.Instance != null)
                    {
                        OceanQualitySettings.Instance.QualityChanged(CETO_QUALITY_SETTING.HIGH);
                    }
                }
            }
        }
    }
コード例 #2
0
    private void Update()
    {
        if (this.farShadowCascade.enableFarShadows != (TheForestQualitySettings.UserSettings.FarShadowMode == TheForestQualitySettings.FarShadowModes.On))
        {
            this.farShadowCascade.enableFarShadows = !this.farShadowCascade.enableFarShadows;
        }
        if (PlayerPreferences.ColorGrading >= 0 && PlayerPreferences.ColorGrading < this.AmplifyColorGradients.Length)
        {
            this.ScionStuff.colorGradingTex1 = this.AmplifyColorGradients[PlayerPreferences.ColorGrading];
        }
        if (LocalPlayer.Inventory && LocalPlayer.Inventory.enabled)
        {
            float num = (!LocalPlayer.Stats.IsInNorthColdArea()) ? 0.5f : 1.75f;
            if (!Mathf.Approximately(this.ScionStuff.exposureCompensation, num))
            {
                this.ScionStuff.exposureCompensation = Mathf.Lerp(this.ScionStuff.exposureCompensation, num, Time.deltaTime);
            }
        }
        if (this.frostEffect)
        {
            this.frostEffect.enabled = (this.frostEffect.coverage > 0f);
        }
        if (this.bleedEffect)
        {
            if (Application.isPlaying)
            {
                this.bleedEffect.enabled = (BleedBehavior.BloodAmount > 0f);
            }
            else
            {
                this.bleedEffect.enabled = (this.bleedEffect.TestingBloodAmount > 0f);
            }
        }
        TheForestQualitySettings.AntiAliasingTechnique antiAliasingTechnique = TheForestQualitySettings.UserSettings.AntiAliasing;
        if (SystemInfo.systemMemorySize <= 4096 || PlayerPreferences.LowMemoryMode)
        {
            antiAliasingTechnique = TheForestQualitySettings.AntiAliasingTechnique.None;
        }
        if (this.aa_FXAA)
        {
            this.aa_FXAA.enabled = (antiAliasingTechnique == TheForestQualitySettings.AntiAliasingTechnique.FXAA);
        }
        if (this.aa_SMAA)
        {
            this.aa_SMAA.enabled = (antiAliasingTechnique == TheForestQualitySettings.AntiAliasingTechnique.SMAA);
        }
        if (this.amplifyMotion)
        {
            this.amplifyMotion.enabled = (TheForestQualitySettings.UserSettings.MotionBlur != TheForestQualitySettings.MotionBlurQuality.None);
            switch (TheForestQualitySettings.UserSettings.MotionBlur)
            {
            case TheForestQualitySettings.MotionBlurQuality.Low:
                this.amplifyMotion.QualityLevel = Quality.Mobile;
                this.amplifyMotion.QualitySteps = 2;
                break;

            case TheForestQualitySettings.MotionBlurQuality.Medium:
                this.amplifyMotion.QualityLevel = Quality.Standard;
                this.amplifyMotion.QualitySteps = 2;
                break;

            case TheForestQualitySettings.MotionBlurQuality.High:
                this.amplifyMotion.QualityLevel = Quality.Standard;
                this.amplifyMotion.QualitySteps = 3;
                break;

            case TheForestQualitySettings.MotionBlurQuality.Ultra:
                this.amplifyMotion.QualityLevel = Quality.SoftEdge_SM3;
                this.amplifyMotion.QualitySteps = 3;
                break;
            }
        }
        if (this.MyCamera)
        {
            this.MyCamera.renderingPath = RenderingPath.DeferredLighting;
            switch (TheForestQualitySettings.UserSettings.MyRenderType)
            {
            case TheForestQualitySettings.RendererType.Deferred:
                this.MyCamera.renderingPath = RenderingPath.DeferredShading;
                break;

            case TheForestQualitySettings.RendererType.LegacyDeferred:
                this.MyCamera.renderingPath = RenderingPath.DeferredLighting;
                break;

            case TheForestQualitySettings.RendererType.Forward:
                this.MyCamera.renderingPath = RenderingPath.Forward;
                break;
            }
        }
        if (PlayerPreferences.is32bit)
        {
            this.ScionStuff.bloomDownsamples = 4;
        }
        TheForestQualitySettings.SEBloomTechnique sEBloom = TheForestQualitySettings.UserSettings.SEBloom;
        if (sEBloom != TheForestQualitySettings.SEBloomTechnique.Normal)
        {
            if (sEBloom == TheForestQualitySettings.SEBloomTechnique.None)
            {
                this.ScionStuff.bloom = false;
            }
        }
        else
        {
            this.ScionStuff.bloom = true;
        }
        TheForestQualitySettings.ChromaticAberration cA = TheForestQualitySettings.UserSettings.CA;
        if (cA != TheForestQualitySettings.ChromaticAberration.Normal)
        {
            if (cA == TheForestQualitySettings.ChromaticAberration.None)
            {
                this.ScionStuff.chromaticAberration = false;
            }
        }
        else
        {
            this.ScionStuff.chromaticAberration = true;
        }
        TheForestQualitySettings.FilmGrain fg = TheForestQualitySettings.UserSettings.Fg;
        if (fg != TheForestQualitySettings.FilmGrain.Normal)
        {
            if (fg == TheForestQualitySettings.FilmGrain.None)
            {
                this.ScionStuff.grainIntensity = 0f;
            }
        }
        else
        {
            this.ScionStuff.grainIntensity = 0.07f;
        }
        TheForestQualitySettings.Dof dofTech = TheForestQualitySettings.UserSettings.DofTech;
        if (dofTech != TheForestQualitySettings.Dof.Normal)
        {
            if (dofTech == TheForestQualitySettings.Dof.None)
            {
                if (this.ScionStuff.depthOfField)
                {
                    this.ScionStuff.depthOfField = false;
                }
            }
        }
        else if (!this.ScionStuff.depthOfField)
        {
            this.ScionStuff.depthOfField = true;
        }
        if (Application.isPlaying && Sunshine.Instance)
        {
            Sunshine.Instance.ScatterResolution      = TheForestQualitySettings.UserSettings.ScatterResolution;
            Sunshine.Instance.ScatterSamplingQuality = TheForestQualitySettings.UserSettings.ScatterSamplingQuality;
            if (this.SunshineOccluders.value != 0)
            {
                bool flag = TheForestQualitySettings.UserSettings.SunshineOcclusion == TheForestQualitySettings.SunshineOcclusionOn.On || (Scene.Atmosphere && Scene.Atmosphere.InACave);
                Sunshine.Instance.Occluders = ((!flag) ? 0 : this.SunshineOccluders.value);
            }
            else
            {
                this.SunshineOccluders = Sunshine.Instance.Occluders;
            }
        }
        TheForestQualitySettings.SSAOTechnique sSAOTechnique = TheForestQualitySettings.UserSettings.SSAO;
        if (SystemInfo.systemMemorySize <= 4096 || PlayerPreferences.LowMemoryMode)
        {
            sSAOTechnique = TheForestQualitySettings.SSAOTechnique.Off;
        }
        if (this.sessao && (TheForestQualitySettings.UserSettings.SSAOType == TheForestQualitySettings.SSAOTypes.SESSAO || !this.hbao))
        {
            this.sessao.enabled = (sSAOTechnique != TheForestQualitySettings.SSAOTechnique.Off);
            if (this.hbao)
            {
                this.hbao.enabled = false;
            }
            switch (sSAOTechnique)
            {
            case TheForestQualitySettings.SSAOTechnique.Ultra:
                this.sessao.halfSampling = false;
                break;

            case TheForestQualitySettings.SSAOTechnique.High:
            case TheForestQualitySettings.SSAOTechnique.Low:
                this.sessao.halfSampling = true;
                break;
            }
        }
        else if ((this.hbao && TheForestQualitySettings.UserSettings.SSAOType == TheForestQualitySettings.SSAOTypes.HBAO) || !this.sessao)
        {
            this.hbao.enabled = (sSAOTechnique != TheForestQualitySettings.SSAOTechnique.Off);
            if (this.sessao)
            {
                this.sessao.enabled = false;
            }
            switch (sSAOTechnique)
            {
            case TheForestQualitySettings.SSAOTechnique.Ultra:
                if (this.hbao.generalSettings.quality != HBAO.Quality.Highest)
                {
                    this.hbao.ApplyPreset(HBAO.Preset.HighestQuality);
                }
                break;

            case TheForestQualitySettings.SSAOTechnique.High:
                if (this.hbao.generalSettings.quality != HBAO.Quality.Medium)
                {
                    this.hbao.ApplyPreset(HBAO.Preset.FastestPerformance);
                }
                break;

            case TheForestQualitySettings.SSAOTechnique.Low:
                if (this.hbao.generalSettings.quality != HBAO.Quality.Lowest)
                {
                    this.hbao.ApplyPreset(HBAO.Preset.FastestPerformance);
                }
                break;
            }
        }
        if (LocalPlayer.WaterEngine)
        {
            switch (TheForestQualitySettings.UserSettings.ReflexionMode)
            {
            case TheForestQualitySettings.ReflexionModes.Complex:
                LocalPlayer.WaterEngine.reflectionLayers = this.reflexionMode_complex;
                break;

            case TheForestQualitySettings.ReflexionModes.Simple:
                LocalPlayer.WaterEngine.reflectionLayers = this.reflexionMode_simple;
                break;

            case TheForestQualitySettings.ReflexionModes.Off:
                LocalPlayer.WaterEngine.reflectionLayers = this.reflexionMode_off;
                break;
            }
            if (Scene.Atmosphere.InACave)
            {
                Scene.OceanFlat.SetActive(false);
                Scene.OceanCeto.SetActive(false);
                this.CurrentOceanQuality = (TheForestQualitySettings.OceanQualities)(-1);
            }
            else if (TheForestQualitySettings.UserSettings.OceanQuality != this.CurrentOceanQuality)
            {
                this.CurrentOceanQuality = ((!PlayerPreferences.is32bit) ? TheForestQualitySettings.UserSettings.OceanQuality : TheForestQualitySettings.OceanQualities.Flat);
                switch (TheForestQualitySettings.UserSettings.OceanQuality)
                {
                case TheForestQualitySettings.OceanQualities.WaveDisplacementHigh:
                    Scene.OceanFlat.SetActive(false);
                    Scene.OceanCeto.SetActive(true);
                    this.waterBlurCeto.enabled = true;
                    if (OceanQualitySettings.Instance != null)
                    {
                        OceanQualitySettings.Instance.QualityChanged(CETO_QUALITY_SETTING.HIGH);
                    }
                    break;

                case TheForestQualitySettings.OceanQualities.WaveDisplacementLow:
                    Scene.OceanFlat.SetActive(false);
                    Scene.OceanCeto.SetActive(true);
                    this.waterBlurCeto.enabled = true;
                    if (OceanQualitySettings.Instance != null)
                    {
                        OceanQualitySettings.Instance.QualityChanged(CETO_QUALITY_SETTING.LOW);
                    }
                    break;

                case TheForestQualitySettings.OceanQualities.Flat:
                    Scene.OceanFlat.SetActive(true);
                    Scene.OceanCeto.SetActive(false);
                    this.waterBlurCeto.enabled = false;
                    break;
                }
            }
        }
    }