internal static void UpdateRenderSettings(MyRenderSettings1 settings)
        {
            Log.WriteLine("UpdateRenderSettings");
            Log.IncreaseIndent();

            var prevSettings = m_renderSettings;

            m_renderSettings = settings;

            LogUpdateRenderSettings(ref settings);

            MyRenderConstants.SwitchRenderQuality(settings.Dx9Quality); //because of lod ranges

            // THIS IS SHIT! MOVE TO USE JUST ONE STRUCT FOR RENDER SETTINGS!!!!!
            MyRender11.Settings.EnableCameraInterpolation = settings.InterpolationEnabled;
            MyRender11.Settings.EnableObjectInterpolation = settings.InterpolationEnabled;

            MyRender11.Settings.GrassDensityFactor = settings.GrassDensityFactor;
            if (settings.GrassDensityFactor == 0.0f)
            {
                m_renderSettings.FoliageDetails = MyFoliageDetails.DISABLED;
            }
            MyRender11.Settings.ModelQuality = settings.ModelQuality;
            MyRender11.Settings.VoxelQuality = settings.VoxelQuality;

            //       if(settings.GrassDensityFactor != prevSettings.GrassDensityFactor)
            //           MyRenderProxy.ReloadGrass();

            if (settings.ShadowQuality != prevSettings.ShadowQuality)
            {
                ResetShadows(MyShadowCascades.Settings.NewData.CascadesCount, settings.ShadowQuality.ShadowCascadeResolution());
            }

            if (settings.AntialiasingMode != prevSettings.AntialiasingMode)
            {
                UpdateAntialiasingMode(settings.AntialiasingMode, prevSettings.AntialiasingMode);
            }

            if (settings.AnisotropicFiltering != prevSettings.AnisotropicFiltering)
            {
                MySamplerStateManager.UpdateFiltering();
            }

            if (settings.TextureQuality != prevSettings.TextureQuality)
            {
                MyVoxelMaterials1.InvalidateMaterials();
                MyMeshMaterials1.InvalidateMaterials();
                MyManagers.FileTextures.DisposeTex(MyFileTextureManager.MyFileTextureHelper.IsQualityDependantFilter);
                MyManagers.DynamicFileArrayTextures.ReloadAll();

                //MyVoxelMaterials.ReloadTextures();
                //MyMaterialProxyFactory.ReloadTextures();
            }

            m_settingsChangedListeners();

            Log.DecreaseIndent();
        }
Example #2
0
        internal static void UpdateRenderSettings(MyRenderSettings settings)
        {
            Log.WriteLine("UpdateRenderSettings");
            Log.IncreaseIndent();

            var prevSettings = Settings;

            Settings = settings;

            LogUpdateRenderSettings();

            if (settings.User.GrassDensityFactor != prevSettings.User.GrassDensityFactor)
            {
                DisposeGrass();
            }

            MyRenderConstants.SwitchRenderQuality(settings.User.Dx9Quality); //because of lod ranges

            if (settings.User.ShadowQuality != prevSettings.User.ShadowQuality)
            {
                ResetShadows(MyShadowCascades.Settings.NewData.CascadesCount, settings.User.ShadowQuality.ShadowCascadeResolution());
            }

            if (settings.User.AntialiasingMode != prevSettings.User.AntialiasingMode)
            {
                UpdateAntialiasingMode(settings.User.AntialiasingMode, prevSettings.User.AntialiasingMode);
            }

            if (settings.User.AnisotropicFiltering != prevSettings.User.AnisotropicFiltering)
            {
                MySamplerStateManager.UpdateFiltering();
            }

            if (settings.User.TextureQuality != prevSettings.User.TextureQuality)
            {
                MyVoxelMaterials1.InvalidateMaterials();
                MyMeshMaterials1.InvalidateMaterials();
                MyManagers.FileTextures.DisposeTex(MyFileTextureManager.MyFileTextureHelper.IsQualityDependantFilter);
                MyManagers.DynamicFileArrayTextures.ReloadAll();

                //MyVoxelMaterials.ReloadTextures();
                //MyMaterialProxyFactory.ReloadTextures();
            }

            m_settingsChangedListeners();

            Log.DecreaseIndent();
        }