Example #1
0
        public override void StartPre(ICoreAPI api)
        {
            if (!(api is ICoreClientAPI))
            {
                return;
            }

            SetConfigDefaults();

            Instance = this;
            CApi     = (ICoreClientAPI)api;
            Events   = new Events();
            Uniforms = new Uniforms(this);
            Debug    = Environment.GetEnvironmentVariable("VOLUMETRICSHADING_DEBUG").ToBool();
            if (Debug)
            {
                Mod.Logger.Event("Debugging activated");
            }

            ShaderPatcher                   = new ShaderPatcher(CApi);
            ShaderInjector                  = new ShaderInjector(CApi, Mod.Info.ModID);
            VolumetricLighting              = new VolumetricLighting(this);
            ScreenSpaceReflections          = new ScreenSpaceReflections(this);
            OverexposureEffect              = new OverexposureEffect(this);
            ScreenSpaceDirectionalOcclusion = new ScreenSpaceDirectionalOcclusion(this);
            ShadowTweaks     = new ShadowTweaks(this);
            DeferredLighting = new DeferredLighting(this);
            UnderwaterTweaks = new UnderwaterTweaks(this);

            ShaderInjector.Debug = Debug;
        }
 protected override void Awake()
 {
     if (!postProcessingProfile.TryGetSettings <ScreenSpaceReflections>(out ssr))           //Try to get the setting override
     {
         ssr = postProcessingProfile.AddSettings <ScreenSpaceReflections>();                //Create one if it can't be found
     }
     base.Awake();
 }
Example #3
0
 // Token: 0x06000C14 RID: 3092 RVA: 0x0004BD6C File Offset: 0x00049F6C
 public void ApplyScreenSpaceReflectionSetting()
 {
     if (!XRDevice.isPresent)
     {
         ScreenSpaceReflections screenSpaceReflections = null;
         this.postProcessingVolume.profile.TryGetSettings <ScreenSpaceReflections>(out screenSpaceReflections);
         screenSpaceReflections.enabled.value = (PlayerPrefs.GetInt("reflectionValue") == 1);
     }
 }
Example #4
0
    // Token: 0x06000A9B RID: 2715 RVA: 0x000420F4 File Offset: 0x000402F4
    public void SetValues()
    {
        PlayerPrefs.SetInt("volumetricLightingValue", this.volumetricLightingValue);
        PlayerPrefs.SetInt("fovValue", this.fovValue);
        PlayerPrefs.SetInt("vsyncValue", this.vsyncValue);
        PlayerPrefs.SetFloat("sensitivityValue", this.sensitivityValue);
        PlayerPrefs.SetInt("reflectionValue", this.reflectionValue);
        PlayerPrefs.SetFloat("cursorBrightnessValue", this.cursorBrightnessValue);
        PlayerPrefs.SetInt("invertedXLookValue", this.invertedXLookValue);
        PlayerPrefs.SetInt("invertedYLookValue", this.invertedYLookValue);
        PlayerPrefs.SetInt("localPushToTalkValue", this.localPushToTalkValue);
        if (XRDevice.isPresent)
        {
            return;
        }
        QualitySettings.vSyncCount = this.vsyncValue;
        if (this.vsyncValue == 0)
        {
            Application.targetFrameRate = 240;
        }
        MainManager.instance.localPlayer.cam.fieldOfView = (float)PlayerPrefs.GetInt("fovValue");
        MainManager.instance.localPlayer.pcPropGrab.ChangeItemSpotWithFOV((float)PlayerPrefs.GetInt("fovValue"));
        MainManager.instance.localPlayer.itemSway.SetPosition();
        bool flag  = PlayerPrefs.GetInt("invertedXLookValue") == 1;
        bool flag2 = PlayerPrefs.GetInt("invertedYLookValue") == 1;

        MainManager.instance.localPlayer.firstPersonController.m_MouseLook.XSensitivity = (flag ? (-PlayerPrefs.GetFloat("sensitivityValue")) : PlayerPrefs.GetFloat("sensitivityValue"));
        MainManager.instance.localPlayer.firstPersonController.m_MouseLook.YSensitivity = (flag2 ? (-PlayerPrefs.GetFloat("sensitivityValue")) : PlayerPrefs.GetFloat("sensitivityValue"));
        MainManager.instance.localPlayer.pcCanvas.UpdateCursorBrightness();
        if (PlayerPrefs.GetInt("volumetricLightingValue") != 0)
        {
            MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricCamera>().enabled      = true;
            MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricImageEffect>().enabled = true;
            if (PlayerPrefs.GetInt("volumetricLightingValue") == 1)
            {
                MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricCamera>().resolution = HxVolumetricCamera.Resolution.quarter;
            }
            else if (PlayerPrefs.GetInt("volumetricLightingValue") == 2)
            {
                MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricCamera>().resolution = HxVolumetricCamera.Resolution.half;
            }
            else if (PlayerPrefs.GetInt("volumetricLightingValue") == 3)
            {
                MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricCamera>().resolution = HxVolumetricCamera.Resolution.full;
            }
        }
        else
        {
            MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricCamera>().enabled      = false;
            MainManager.instance.localPlayer.headObject.GetComponent <HxVolumetricImageEffect>().enabled = false;
        }
        ScreenSpaceReflections screenSpaceReflections = null;

        MainManager.instance.localPlayer.postProcessingVolume.profile.TryGetSettings <ScreenSpaceReflections>(out screenSpaceReflections);
        screenSpaceReflections.enabled.value = (PlayerPrefs.GetInt("reflectionValue") == 1);
    }
        internal void InitializeProfiles()
        {
            if (!SettingValues.profile.TryGetSettings(out chromaticAberrationLayer))
            {
                chromaticAberrationLayer = SettingValues.profile.AddSettings <ChromaticAberration>();
            }

            if (!SettingValues.profile.TryGetSettings(out grainLayer))
            {
                grainLayer = SettingValues.profile.AddSettings <Grain>();
            }

            if (!SettingValues.profile.TryGetSettings(out ambientOcclusionLayer))
            {
                ambientOcclusionLayer = SettingValues.profile.AddSettings <AmbientOcclusion>();
            }

            if (!SettingValues.profile.TryGetSettings(out autoExposureLayer))
            {
                autoExposureLayer = SettingValues.profile.AddSettings <AutoExposure>();
            }

            if (!SettingValues.profile.TryGetSettings(out bloomLayer))
            {
                bloomLayer = SettingValues.profile.AddSettings <Bloom>();
            }

            if (!SettingValues.profile.TryGetSettings(out colorGradingLayer))
            {
                colorGradingLayer = SettingValues.profile.AddSettings <ColorGrading>();
            }

            if (!SettingValues.profile.TryGetSettings(out depthOfFieldLayer))
            {
                depthOfFieldLayer = SettingValues.profile.AddSettings <DepthOfField>();
            }

            if (!SettingValues.profile.TryGetSettings(out screenSpaceReflectionsLayer))
            {
                screenSpaceReflectionsLayer = SettingValues.profile.AddSettings <ScreenSpaceReflections>();
            }

            if (!SettingValues.profile.TryGetSettings(out vignetteLayer))
            {
                vignetteLayer = SettingValues.profile.AddSettings <Vignette>();
            }

            if (!SettingValues.profile.TryGetSettings(out motionBlurLayer))
            {
                motionBlurLayer = SettingValues.profile.AddSettings <MotionBlur>();
                motionBlurLayer.enabled.value = false;
            }

            depthOfFieldLayer.enabled.value = false; // Make people use Depth of Field Manually
        }
    // Start is called before the first frame update
    void Start()
    {
        p_ambientOcclusion   = ScriptableObject.CreateInstance <AmbientOcclusion>();
        p_chromaticAberation = ScriptableObject.CreateInstance <ChromaticAberration>();
        p_bloom                  = ScriptableObject.CreateInstance <Bloom>();
        p_colorGrading           = ScriptableObject.CreateInstance <ColorGrading>();
        p_motionBlur             = ScriptableObject.CreateInstance <MotionBlur>();
        p_screenSpaceReflections = ScriptableObject.CreateInstance <ScreenSpaceReflections>();
        p_vignette               = ScriptableObject.CreateInstance <Vignette>();
        p_volume                 = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, p_ambientOcclusion, p_chromaticAberation, p_bloom,
                                                                           p_colorGrading, p_motionBlur, p_screenSpaceReflections, p_vignette);
        p_ambientOcclusion.enabled.Override(true);
        p_chromaticAberation.enabled.Override(true);
        p_bloom.enabled.Override(true);
        p_colorGrading.enabled.Override(true);
        p_motionBlur.enabled.Override(true);
        p_screenSpaceReflections.enabled.Override(true);
        p_vignette.enabled.Override(true);

        p_chromaticAberation.intensity.Override(1f);
    }
Example #7
0
    public static void SSRProcess(bool On)
    {
        ScreenSpaceReflections param  = null;
        PostProcessVolume      volume = Camera.main.gameObject.GetComponent <PostProcessVolume>();

        if (volume != null)
        {
            volume.profile.TryGetSettings(out param);
            if (param)
            {
                if (!On)
                {
                    param.enabled.value = false;
                }
                else
                {
                    param.enabled.value = true;
                }
            }
        }
    }
        private void Start()
        {
            List <PostProcessVolume> postProcessVolumeList = ListPool <PostProcessVolume> .Get();

            PostProcessManager.get_instance().GetActiveVolumes(this.PostProcessLayer, postProcessVolumeList, true, true);
            using (List <PostProcessVolume> .Enumerator enumerator = postProcessVolumeList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    PostProcessVolume current  = enumerator.Current;
                    Bloom             setting1 = (Bloom)current.get_profile().GetSetting <Bloom>();
                    if (Object.op_Implicit((Object)setting1))
                    {
                        this._bloom.Add(setting1);
                    }
                    AmbientOcclusion setting2 = (AmbientOcclusion)current.get_profile().GetSetting <AmbientOcclusion>();
                    if (Object.op_Inequality((Object)setting2, (Object)null) && ((PostProcessEffectSettings)setting2).active != null)
                    {
                        this._ao.Add(setting2);
                    }
                    ScreenSpaceReflections setting3 = (ScreenSpaceReflections)current.get_profile().GetSetting <ScreenSpaceReflections>();
                    if (Object.op_Inequality((Object)setting3, (Object)null) && ((PostProcessEffectSettings)setting3).active != null)
                    {
                        this._ssr.Add(setting3);
                    }
                    DepthOfField setting4 = (DepthOfField)current.get_profile().GetSetting <DepthOfField>();
                    if (Object.op_Inequality((Object)setting4, (Object)null) && ((PostProcessEffectSettings)setting4).active != null)
                    {
                        this._dof.Add(setting4);
                    }
                    Vignette setting5 = (Vignette)current.get_profile().GetSetting <Vignette>();
                    if (Object.op_Inequality((Object)setting5, (Object)null) && ((PostProcessEffectSettings)setting5).active != null)
                    {
                        this._vignette.Add(setting5);
                    }
                }
            }
            this.Refresh();
        }
        static void Draw_Settings_SSR(GraphicSystem data, bool draw = true)
        {
            if (!data.SSR)
            {
                return;
            }

            for (int i = 0; i < _ssr.Count; i++)
            {
                ScreenSpaceReflections obj = _ssr[i];
                string name = $"[SSR{i}] ";

                obj.enabled.value               = Field($"{name}Enabled", obj.enabled.value, draw);
                obj.distanceFade.value          = Field($"{name}Distance Fade", obj.distanceFade.value, draw);
                obj.maximumIterationCount.value = Field($"{name}Max Iteration Count", obj.maximumIterationCount, draw);
                obj.maximumMarchDistance.value  = Field($"{name}Max March Distance", obj.maximumMarchDistance.value, draw);
                obj.thickness.value             = Field($"{name}Thickness", obj.thickness.value, draw);
                obj.vignette.value              = Field($"{name}Vignette", obj.vignette.value, draw);
                obj.resolution.value            = Field($"{name}Resolution", obj.resolution.value, draw);
                obj.preset.value = Field($"{name}Preset", obj.preset.value, draw);
            }
        }
        private void Refresh()
        {
            GraphicSystem graphicData = Manager.Config.GraphicData;

            using (List <Bloom> .Enumerator enumerator = this._bloom.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Bloom current = enumerator.Current;
                    if (((PostProcessEffectSettings)current).active != (graphicData.Bloom ? 1 : 0))
                    {
                        ((PostProcessEffectSettings)current).active = (__Null)(graphicData.Bloom ? 1 : 0);
                    }
                }
            }
            using (List <AmbientOcclusion> .Enumerator enumerator = this._ao.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AmbientOcclusion current = enumerator.Current;
                    if (((PostProcessEffectSettings)current).active != (graphicData.SSAO ? 1 : 0))
                    {
                        ((PostProcessEffectSettings)current).active = (__Null)(graphicData.SSAO ? 1 : 0);
                    }
                }
            }
            using (List <ScreenSpaceReflections> .Enumerator enumerator = this._ssr.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ScreenSpaceReflections current = enumerator.Current;
                    if (((PostProcessEffectSettings)current).active != (graphicData.SSR ? 1 : 0))
                    {
                        ((PostProcessEffectSettings)current).active = (__Null)(graphicData.SSR ? 1 : 0);
                    }
                }
            }
            using (List <DepthOfField> .Enumerator enumerator = this._dof.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DepthOfField current = enumerator.Current;
                    if (((PostProcessEffectSettings)current).active != (graphicData.DepthOfField ? 1 : 0))
                    {
                        ((PostProcessEffectSettings)current).active = (__Null)(graphicData.DepthOfField ? 1 : 0);
                    }
                }
            }
            using (List <Vignette> .Enumerator enumerator = this._vignette.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Vignette current = enumerator.Current;
                    if (((PostProcessEffectSettings)current).active != (graphicData.Vignette ? 1 : 0))
                    {
                        ((PostProcessEffectSettings)current).active = (__Null)(graphicData.Vignette ? 1 : 0);
                    }
                }
            }
            if (Singleton <Manager.Map> .IsInstance() && Object.op_Inequality((Object)Singleton <Manager.Map> .Instance.Simulator, (Object)null) && Object.op_Inequality((Object)Singleton <Manager.Map> .Instance.Simulator.EnviroSky, (Object)null))
            {
                EnviroSky enviroSky = Singleton <Manager.Map> .Instance.Simulator.EnviroSky;
                enviroSky.fogSettings.distanceFog     = graphicData.Atmospheric;
                enviroSky.fogSettings.heightFog       = graphicData.Atmospheric;
                enviroSky.volumeLighting              = graphicData.Atmospheric;
                enviroSky.LightShafts.sunLightShafts  = graphicData.Atmospheric;
                enviroSky.LightShafts.moonLightShafts = graphicData.Atmospheric;
            }
            if (!Object.op_Inequality((Object)this.Wetstuff, (Object)null) || ((Behaviour)this.Wetstuff).get_enabled() == graphicData.Rain)
            {
                return;
            }
            ((Behaviour)this.Wetstuff).set_enabled(graphicData.Rain);
        }
        static void Update()
        {
            if (Key.Value.IsDown())
            {
                toggle = !toggle;
            }

            if (!Map.IsInstance() || Map.Instance.Player == null)
            {
                effector = null;
                return;
            }

            if (effector == null)
            {
                effector = Object.FindObjectOfType <ConfigEffector>();

                if (effector == null)
                {
                    return;
                }

                _bloom = new List <Bloom>();
                _ao    = new List <AmbientOcclusion>();
                _ssr   = new List <ScreenSpaceReflections>();
                _dof   = new List <DepthOfField>();

                List <PostProcessVolume> list = ListPool <PostProcessVolume> .Get();

                PostProcessManager.instance.GetActiveVolumes(effector.PostProcessLayer, list, true, true);

                foreach (PostProcessVolume ppv in list)
                {
                    Bloom bloom = ppv.profile.GetSetting <Bloom>();

                    if (bloom)
                    {
                        _bloom.Add(bloom);
                    }

                    AmbientOcclusion ao = ppv.profile.GetSetting <AmbientOcclusion>();

                    if (ao)
                    {
                        _ao.Add(ao);
                    }

                    ScreenSpaceReflections ssr = ppv.profile.GetSetting <ScreenSpaceReflections>();

                    if (ssr)
                    {
                        _ssr.Add(ssr);
                    }

                    DepthOfField dof = ppv.profile.GetSetting <DepthOfField>();

                    if (dof)
                    {
                        _dof.Add(dof);
                    }
                }
            }
        }
Example #12
0
        private void getSettings()
        {
            post_layer = Camera.main.GetComponent <PostProcessLayer>();
            if (post_layer == null)
            {
                if (Main.settings.DEBUG)
                {
                    log("Null post layer");
                }
            }
            if (post_layer.enabled == false)
            {
                post_layer.enabled = true;
                if (Main.settings.DEBUG)
                {
                    log("post_layer was disabled");
                }
            }
            post_volume = FindObjectOfType <PostProcessVolume>();
            if (post_volume != null)
            {
                string not_found = "";
                if ((GAME_AO = post_volume.profile.GetSetting <AmbientOcclusion>()) == null)
                {
                    not_found += "ao,";
                    GAME_AO    = post_volume.profile.AddSettings <AmbientOcclusion>();
                    GAME_AO.enabled.Override(false);
                }
                if ((GAME_EXPO = post_volume.profile.GetSetting <AutoExposure>()) == null)
                {
                    not_found += "expo,";
                    GAME_EXPO  = post_volume.profile.AddSettings <AutoExposure>();
                    GAME_EXPO.enabled.Override(false);
                }
                if ((GAME_BLOOM = post_volume.profile.GetSetting <Bloom>()) == null)
                {
                    not_found += "bloom,";
                    GAME_BLOOM = post_volume.profile.AddSettings <Bloom>();
                    GAME_BLOOM.enabled.Override(false);
                }
                if ((GAME_CA = post_volume.profile.GetSetting <ChromaticAberration>()) == null)
                {
                    not_found += "ca,";
                    GAME_CA    = post_volume.profile.AddSettings <ChromaticAberration>();
                    GAME_CA.enabled.Override(false);
                }
                if ((GAME_COLOR = post_volume.profile.GetSetting <ColorGrading>()) == null)
                {
                    not_found += "color,";
                    GAME_COLOR = post_volume.profile.AddSettings <ColorGrading>();
                    GAME_COLOR.enabled.Override(false);
                }
                if ((GAME_DOF = post_volume.profile.GetSetting <DepthOfField>()) == null)
                {
                    not_found += "dof,";
                    GAME_DOF   = post_volume.profile.AddSettings <DepthOfField>();
                    GAME_DOF.enabled.Override(false);
                }
                if ((GAME_GRAIN = post_volume.profile.GetSetting <Grain>()) == null)
                {
                    not_found += "grain,";
                    GAME_GRAIN = post_volume.profile.AddSettings <Grain>();
                    GAME_GRAIN.enabled.Override(false);
                }
                if ((GAME_BLUR = post_volume.profile.GetSetting <MotionBlur>()) == null)
                {
                    not_found += "blur,";
                    GAME_BLUR  = post_volume.profile.AddSettings <MotionBlur>();
                    GAME_BLUR.enabled.Override(false);
                }
                if ((GAME_LENS = post_volume.profile.GetSetting <LensDistortion>()) == null)
                {
                    not_found += "lens,";
                    GAME_LENS  = post_volume.profile.AddSettings <LensDistortion>();
                    GAME_LENS.enabled.Override(false);
                }
                if ((GAME_REFL = post_volume.profile.GetSetting <ScreenSpaceReflections>()) == null)
                {
                    not_found += "refl,";
                    GAME_REFL  = post_volume.profile.AddSettings <ScreenSpaceReflections>();
                    GAME_REFL.enabled.Override(false);
                }
                if ((GAME_VIGN = post_volume.profile.GetSetting <Vignette>()) == null)
                {
                    not_found += "vign,";
                    GAME_VIGN  = post_volume.profile.AddSettings <Vignette>();
                    GAME_VIGN.enabled.Override(false);
                }
                if (not_found.Length > 0)
                {
                    log("Not found: " + not_found);
                }
            }
            else
            {
                if (Main.settings.DEBUG)
                {
                    log("Post_volume is null in getSettings");
                }
            }

            GAME_FXAA = post_layer.fastApproximateAntialiasing;
            GAME_TAA  = post_layer.temporalAntialiasing;
            GAME_SMAA = post_layer.subpixelMorphologicalAntialiasing;

            bool map_preset_enabled = false;

            if (Main.presets.ContainsKey(Main.map_name))
            {
                map_preset_enabled = Main.presets[Main.map_name].enabled;
            }
            map_preset         = new Preset(Main.map_name);
            map_preset.enabled = map_preset_enabled;
            UpdateMapPreset(map_preset);
            Main.presets[map_preset.name] = map_preset;
            if (!Main.settings.presetOrder.Contains(Main.map_name))
            {
                Main.settings.presetOrder.Add(Main.map_name);
            }

            if (Main.settings.DEBUG)
            {
                log("Before applying");
            }
            ApplySettings();
            ApplyPresets();
            if (Main.settings.DEBUG)
            {
                log("Before after");
            }

            // After applying, can now save
            Main.canSave = true;

            Transform         skater_transform = PlayerController.Instance.skaterController.transform;
            List <GameObject> toHide           = new List <GameObject>();
            List <string>     toHide_names     = new List <string>(new string[] {
                "Cory_fixed_Karam:cory_001:body_geo", "Cory_fixed_Karam:cory_001:eyes_geo",
                "Cory_fixed_Karam:cory_001:lacrima_geo", "Cory_fixed_Karam:cory_001:lashes_geo",
                "Cory_fixed_Karam:cory_001:tear_geo", "Cory_fixed_Karam:cory_001:teethDn_geo",
                "Cory_fixed_Karam:cory_001:teethUp_geo", "Cory_fixed_Karam:cory_001:hat_geo"
            });

            for (int i = 0; i < skater_transform.childCount; i++)
            {
                var child = skater_transform.GetChild(i);
                //log("Child: " + child.name);
                for (int j = 0; j < child.childCount; j++)
                {
                    var grandchild = child.GetChild(j);
                    //log("Grand: " + grandchild.name);
                    for (int k = 0; k < grandchild.childCount; k++)
                    {
                        var grandgrandchild = grandchild.GetChild(k);
                        //log("Grandgrand: " + grandgrandchild.name);
                        if (toHide_names.Contains(grandgrandchild.name))
                        {
                            toHide.Add(grandgrandchild.gameObject);
                        }
                    }
                }
            }

            List <string> mat_names = new List <string>(new string[] {
                "UniqueShaders_head_mat (Instance)", "GenericShaders_eyeInner_mat (Instance)",
                "GenericShaders_eyeOuter_mat (Instance)", "GenericShaders_teeth_mat (Instance)",
                "UniqueShaders_hat_mat (Instance)", "GenericShaders_lacrima_mat (Instance)",
                "GenericShaders_lashes_mat (Instance)", "GenericShaders_tear_mat (Instance)"
            });

            customCameraController.standard_shader = Shader.Find("Standard");
            customCameraController.head_shader     = Shader.Find("shaderStandard");
            customCameraController.head_materials  = new List <Material>();
            foreach (var obj in toHide)
            {
                var materials = obj.GetComponent <SkinnedMeshRenderer>().materials;
                for (int k = 0; k < materials.Length; k++)
                {
                    var mat = materials[k];
                    //log("Obj: " + obj.name + ", mat: " + mat.name);
                    if (mat_names.Contains(mat.name))
                    {
                        customCameraController.head_materials.Add(mat);
                    }
                }
            }

            customCameraController.mainCamera = Camera.main;

            if (Main.settings.DEBUG)
            {
                log("Done getSettings");
            }
        }