Example #1
0
 public static void SetSettings(BloomSetting s)
 {
     if (s == null)
     {
         s = new BloomSetting();
     }
     settings = s;
 }
 private void initValues(BloomSetting mObj)
 {
     BlurAmount.Value      = mObj.BlurAmount;
     BloomThreshold.Value  = mObj.BloomThreshold;
     BloomIntensity.Value  = mObj.BloomIntensity;
     BaseIntensity.Value   = mObj.BaseIntensity;
     BloomSaturation.Value = mObj.BloomSaturation;
     BaseSaturation.Value  = mObj.BaseSaturation;
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (objectToEdit != null && objectToEdit is BloomSetting)
            {
                BloomSetting obj = objectToEdit as BloomSetting;
                txtBaseObjectId.Text      = obj.BaseObjectId;
                txtBaseObjectName.Text    = obj.BaseObjectName;
                isEditingObj              = true;
                txtBaseObjectId.IsEnabled = false;

                initValues(obj);
                cancelRevert = (BloomSetting)Utils.DeepClone(obj);
            }
            else
            {
                BloomSetting bs = new BloomSetting();
                initValues(bs);
            }
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (objectToEdit == null)
            {
                objectToEdit = new BloomSetting();
            }

            BloomSetting obj = objectToEdit as BloomSetting;

            obj.BaseObjectId   = txtBaseObjectId.Text;
            obj.BaseObjectName = txtBaseObjectName.Text;

            //custom code
            obj.BlurAmount      = (float)BlurAmount.Value;
            obj.BloomThreshold  = (float)BloomThreshold.Value;
            obj.BloomIntensity  = (float)BloomIntensity.Value;
            obj.BaseIntensity   = (float)BaseIntensity.Value;
            obj.BloomSaturation = (float)BloomSaturation.Value;
            obj.BaseSaturation  = (float)BaseSaturation.Value;
            //custom code end

            obj.Category = objCategory;
            bool success = isEditingObj ? WorldData.UpdateObject(obj) : WorldData.AddObject(obj);

            if (!success)
            {
                MessageBox.Show(Application.Current.MainWindow, "ID already exists", "AddObject Failure", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel);
            }
            else
            {
                this.Close();
                if (parentWindow != null)
                {
                    parentWindow.Refresh();
                }
            }
        }
Example #5
0
 public void SetBloomProps(BloomSetting setting)
 {
     settings = setting;
 }
            static bool Prefix(Manager.Config __instance)
            {
                var traverse = Traverse.Create(__instance);

                if (!traverse.Method("CheckInstance").GetValue <bool>())
                {
                    return(false);
                }
                GameObject.DontDestroyOnLoad(__instance.gameObject);

                traverse.Property("SoundData").SetValue(new SoundSystem("Sound"));
                traverse.Property("TextData").SetValue(new TextSystem("Text"));
                traverse.Property("EtcData").SetValue(new EtceteraSystem("Etc"));
                traverse.Property("DebugStatus").SetValue(new DebugSystem("Debug"));
                BasicSettings  = new BasicSetting("GraphicBasic");
                BloomSettings  = new BloomSetting("Bloom");
                CurveSettings  = new CurveSetting("ColorCorrectionCurve");
                SSAOSettings   = new SSAOSetting("SSAO");
                SSRSettings    = new SSRSetting("SSR");
                ShadowSettings = new ShadowSetting("Shadow");

                var xmlCtrl = new Control("Config", "Config.xml", "Config", new List <Data> {
                    Manager.Config.SoundData, Manager.Config.TextData, Manager.Config.EtcData, Manager.Config.DebugStatus
                });

                traverse.Field("xmlCtrl").SetValue(xmlCtrl);

                __instance.Load();
                xmlGraphicsSetting = new Control("GraphicSetting", "Config.xml", "GraphicSetting", new List <Data> {
                    BasicSettings
                });
                xmlGraphicsSetting.Read();

                string stylePreset  = BasicSettings.StylePreset;
                string ssaopreset   = BasicSettings.SSAOPreset;
                string ssrpreset    = BasicSettings.SSRPreset;
                string shadowPreset = BasicSettings.ShadowPreset;

                var xmlStyle = new Control("GraphicSetting/Style", stylePreset + ".xml", "Config", new List <Data> {
                    BloomSettings, CurveSettings
                });

                traverse.Field("xmlStyle").SetValue(xmlStyle);

                xmlSSAO = new Control("GraphicSetting/SSAO", ssaopreset + ".xml", "Config", new List <Data> {
                    SSAOSettings
                });
                xmlSSR = new Control("GraphicSetting/SSR", ssrpreset + ".xml", "Config", new List <Data> {
                    SSRSettings
                });
                xmlShadow = new Control("GraphicSetting/Shadow", shadowPreset + ".xml", "Config", new List <Data> {
                    ShadowSettings
                });
                xmlShadow.Read();
                xmlSSAO.Read();
                xmlSSR.Read();
                xmlStyle.Read();

                Manager.Config.ScrollBarValue = 1f;
                if (ShadowSettings.ShadowProjection == 0)
                {
                    QualitySettings.shadowProjection = ShadowProjection.CloseFit;
                }
                else if (ShadowSettings.ShadowProjection == 1)
                {
                    QualitySettings.shadowProjection = ShadowProjection.StableFit;
                }

                QualitySettings.shadowNearPlaneOffset            = ShadowSettings.ShadowNearPlaneOffset;
                QualitySettings.shadowDistance                   = ShadowSettings.ShadowDistance;
                QualitySettings.shadowCascades                   = ShadowSettings.ShadowCascades;
                QualitySettings.shadowCascade2Split              = ShadowSettings.ShadowCascade2Split;
                QualitySettings.shadowCascade4Split              = new Vector3(ShadowSettings.ShadowCascade4Split_x, ShadowSettings.ShadowCascade4Split_y, ShadowSettings.ShadowCascade4Split_z);
                QualitySettings.antiAliasing                     = BasicSettings.MSAA;
                HarmonyPatch_BloomAndFlares.BlmIntst             = BloomSettings.Bloomintensity;
                HarmonyPatch_BloomAndFlares.BlmSprd              = BloomSettings.BloomBlurSpread;
                HarmonyPatch_BloomAndFlares.BlmThrshd            = BloomSettings.BloomThreshold;
                HarmonyPatch_ColorCorrectionCurves.CCCCustom     = CurveSettings.Curve;
                HarmonyPatch_ColorCorrectionCurves.CCCName       = CurveSettings.CurveName;
                HarmonyPatch_ColorCorrectionCurves.CCCSaturation = CurveSettings.CurveSaturation;
                HarmonyPatch_ScreenSpaceReflection.SSRPresets    = SSRSettings.SSRpresets;
                if (HarmonyPatch_ScreenSpaceReflection.SSRPresets != 0)
                {
                    return(false);
                }

                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.screenEdgeFading               = SSRSettings.SSRscreenEdgeFading;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.maxDistance                    = SSRSettings.SSRmaxDistance;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.fadeDistance                   = SSRSettings.SSRfadeDistance;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.reflectionMultiplier           = SSRSettings.SSRreflectionMultiplier;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.enableHDR                      = SSRSettings.SSRenableHDR;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.basicSettings.additiveReflection             = SSRSettings.SSRadditiveReflection;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.maxSteps                  = SSRSettings.SSRmaxSteps;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.rayStepSize               = SSRSettings.SSRrayStepSize;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.widthModifier             = SSRSettings.SSRwidthModifier;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.smoothFallbackThreshold   = SSRSettings.SSRsmoothFallbackThreshold;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.distanceBlur              = SSRSettings.SSRdistanceBlur;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.fresnelFade               = SSRSettings.SSRfresnelFade;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.fresnelFadePower          = SSRSettings.SSRfresnelFadePower;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.reflectionSettings.smoothFallbackDistance    = SSRSettings.SSRsmoothFallbackDistance;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.useTemporalConfidence       = SSRSettings.SSRuseTemporalConfidence;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.temporalFilterStrength      = SSRSettings.SSRtemporalFilterStrength;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.treatBackfaceHitAsMiss      = SSRSettings.SSRtreatBackfaceHitAsMiss;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.allowBackwardsRays          = SSRSettings.SSRallowBackwardsRays;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.traceBehindObjects          = SSRSettings.SSRtraceBehindObjects;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.highQualitySharpReflections = SSRSettings.SSRhighQualitySharpReflections;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.traceEverywhere             = SSRSettings.SSRtraceEverywhere;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.bilateralUpsample           = SSRSettings.SSRbilateralUpsample;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.improveCorners              = SSRSettings.SSRimproveCorners;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.reduceBanding               = SSRSettings.SSRreduceBanding;
                HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.highlightSuppression        = SSRSettings.SSRhighlightSuppression;

                switch (SSRSettings.SSRresolution)
                {
                case 0:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.resolution = ScreenSpaceReflection.SSRResolution.FullResolution;
                    break;

                case 1:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.resolution = ScreenSpaceReflection.SSRResolution.HalfTraceFullResolve;
                    break;

                case 2:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.advancedSettings.resolution = ScreenSpaceReflection.SSRResolution.HalfResolution;
                    break;
                }

                switch (SSRSettings.SSRdebugMode)
                {
                case 0:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.None;
                    return(false);

                case 1:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.IncomingRadiance;
                    return(false);

                case 2:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SSRResult;
                    return(false);

                case 3:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.FinalGlossyTerm;
                    return(false);

                case 4:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SSRMask;
                    return(false);

                case 5:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.Roughness;
                    return(false);

                case 6:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.BaseColor;
                    return(false);

                case 7:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SpecColor;
                    return(false);

                case 8:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.Reflectivity;
                    return(false);

                case 9:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.ReflectionProbeOnly;
                    return(false);

                case 10:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.ReflectionProbeMinusSSR;
                    return(false);

                case 11:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.SSRMinusReflectionProbe;
                    return(false);

                case 12:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.NoGlossy;
                    return(false);

                case 13:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.NegativeNoGlossy;
                    return(false);

                case 14:
                    HarmonyPatch_ScreenSpaceReflection.MySSRPresets.debugSettings.debugMode = ScreenSpaceReflection.SSRDebugMode.MipLevel;
                    return(false);

                default:
                    return(false);
                }
            }