Example #1
0
        void overall_Update(object sender, Graphics.UpdateEventArgs e)
        {
            if (((DropDownItem <VideoQualities>)overall.SelectedItem) == null)
            {
                return;
            }
            var videoQuality = ((DropDownItem <VideoQualities>)overall.SelectedItem).Value;

            if (PreviousOverallVideoQuality != videoQuality)
            {
                UpdateOverallSettings();
                PreviousOverallVideoQuality = videoQuality;
            }

            if (videoQuality != VideoQualities.Custom)
            {
                var aq = animation.SelectedItem as DropDownItem <Graphics.Renderer.Settings.AnimationQualities>;
                var lq = lightingQuality.SelectedItem as DropDownItem <Graphics.Renderer.Settings.LightingQualities>;
                var sq = shadowQuality.SelectedItem as DropDownItem <Graphics.Renderer.Settings.ShadowQualities>;
                var tq = terrainQuality.SelectedItem as DropDownItem <Graphics.Renderer.Settings.TerrainQualities>;

                if (aq != null && aq.Value != SettingProfiles.GetAnimationQuality(videoQuality))
                {
                    overall.SelectedItem = new DropDownItem <VideoQualities>(VideoQualities.Custom);
                }
                else if (lq != null && lq.Value != SettingProfiles.GetLightingQuality(videoQuality))
                {
                    overall.SelectedItem = new DropDownItem <VideoQualities>(VideoQualities.Custom);
                }
                else if (sq != null && sq.Value != SettingProfiles.GetShadowQuality(videoQuality))
                {
                    overall.SelectedItem = new DropDownItem <VideoQualities>(VideoQualities.Custom);
                }
                else if (tq != null && tq.Value != SettingProfiles.GetTerrainQuality(videoQuality))
                {
                    overall.SelectedItem = new DropDownItem <VideoQualities>(VideoQualities.Custom);
                }
            }

            accTime += e.Dtime;
            if (tic < accTime)
            {
                UpdateOverallSettings();
                if (((DropDownItem <VideoQualities>)overall.SelectedItem).Value == VideoQualities.Low)
                {
                    shadowQuality.SelectedItem = new DropDownItem <Graphics.Renderer.Settings.ShadowQualities>(Graphics.Renderer.Settings.ShadowQualities.NoShadows);
                }
                accTime = 0;
            }
        }
        public void InitilizeToDefaults()
        {
            int recommendedVideoQuality = Graphics.GraphicsDevice.SettingsUtilities.FindRecommendedVideoSettings();

            Graphics.Application.Log("Default video quality: " + Enum.GetValues(typeof(VideoQualities)).GetValue(3 - recommendedVideoQuality));

            if (recommendedVideoQuality == 3)
            {
                VideoQuality = VideoQualities.Low;
            }
            else if (recommendedVideoQuality == 2)
            {
                VideoQuality = VideoQualities.Medium;
            }
            else if (recommendedVideoQuality == 1)
            {
                VideoQuality = VideoQualities.High;
            }
            else
            {
                VideoQuality = VideoQualities.Ultra;
            }

            var anti = Graphics.GraphicsDevice.SettingConverters.AntiAliasingConverter.MultiSampleTypes;

            if (anti.Count >= 4)
            {
                GraphicsDeviceSettings.AntiAliasing = anti[anti.Count - recommendedVideoQuality - 1];
            }
            else
            {
                GraphicsDeviceSettings.AntiAliasing = anti[0];
            }

            var texFilt = Graphics.GraphicsDevice.SettingConverters.TextureFilteringConverter.TextureFilteringTypesDict;

            if (texFilt.Count >= 6)
            {
                if (VideoQuality == VideoQualities.Ultra)
                {
                    RendererSettings.TextureFilter = texFilt[Graphics.Renderer.TextureFilterEnum.Anisotropic16x];
                }

                if (VideoQuality == VideoQualities.High)
                {
                    RendererSettings.TextureFilter = texFilt[Graphics.Renderer.TextureFilterEnum.Anisotropic8x];
                }

                if (VideoQuality == VideoQualities.Medium)
                {
                    RendererSettings.TextureFilter = texFilt[Graphics.Renderer.TextureFilterEnum.Anisotropic4x];
                }

                if (VideoQuality == VideoQualities.Low)
                {
                    RendererSettings.TextureFilter = texFilt[Graphics.Renderer.TextureFilterEnum.Trilinear];
                }
            }
            else
            {
                RendererSettings.TextureFilter = texFilt[Graphics.Renderer.TextureFilterEnum.Bilinear];
            }

            RendererSettings.AnimationQuality = SettingProfiles.GetAnimationQuality(VideoQuality);
            RendererSettings.LightingQuality  = SettingProfiles.GetLightingQuality(VideoQuality);
            RendererSettings.ShadowQuality    = SettingProfiles.GetShadowQuality(VideoQuality);
            RendererSettings.TerrainQuality   = SettingProfiles.GetTerrainQuality(VideoQuality);
        }
Example #3
0
        void UpdateOverallSettings()
        {
            var vq = ((DropDownItem <VideoQualities>)overall.SelectedItem).Value;

            if (vq != VideoQualities.Custom)
            {
                animation.SelectedItem       = new DropDownItem <Graphics.Renderer.Settings.AnimationQualities>(SettingProfiles.GetAnimationQuality(vq));
                lightingQuality.SelectedItem = new DropDownItem <Graphics.Renderer.Settings.LightingQualities>(SettingProfiles.GetLightingQuality(vq));
                shadowQuality.SelectedItem   = new DropDownItem <Graphics.Renderer.Settings.ShadowQualities>(SettingProfiles.GetShadowQuality(vq));
                terrainQuality.SelectedItem  = new DropDownItem <Graphics.Renderer.Settings.TerrainQualities>(SettingProfiles.GetTerrainQuality(vq));
            }
        }