| | 1 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 2 | | using System; |
| | 3 | | using UnityEngine; |
| | 4 | | using ShaderQuality = DCL.SettingsCommon.QualitySettings.ShaderQuality; |
| | 5 | |
|
| | 6 | | namespace MainScripts.DCL.Controllers.Settings.SettingsControllers.SpecificControllers |
| | 7 | | { |
| | 8 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Shader Quality", fileName = "ShaderQualityControlControll |
| | 9 | | public class ShaderQualityControlController : SpinBoxSettingsControlController |
| | 10 | | { |
| | 11 | | [SerializeField] private OutlineScreenEffectFeature outlineScreenEffectFeature; |
| | 12 | |
|
| 1 | 13 | | private static readonly int GAUSSIAN_BLUR_KERNEL_SIZE = Shader.PropertyToID("gaussianBlurQuality"); |
| | 14 | |
|
| | 15 | | public override object GetStoredValue() => |
| 1 | 16 | | (int)currentQualitySetting.shaderQuality; |
| | 17 | |
|
| | 18 | | public override void UpdateSetting(object newValue) |
| | 19 | | { |
| 1 | 20 | | OutlineScreenEffectFeature.OutlineSettings outlineSettings = outlineScreenEffectFeature.settings; |
| 1 | 21 | | currentQualitySetting.shaderQuality = (ShaderQuality)newValue; |
| | 22 | |
|
| 1 | 23 | | switch (currentQualitySetting.shaderQuality) |
| | 24 | | { |
| | 25 | | case ShaderQuality.LOW: |
| 1 | 26 | | Shader.SetGlobalInt(GAUSSIAN_BLUR_KERNEL_SIZE, 4); |
| 1 | 27 | | outlineSettings.blurSize = 1; |
| 1 | 28 | | outlineSettings.blurSigma = 5; |
| 1 | 29 | | outlineSettings.outlineThickness = 0.5f; |
| 1 | 30 | | break; |
| | 31 | | case ShaderQuality.MID: |
| 0 | 32 | | Shader.SetGlobalInt(GAUSSIAN_BLUR_KERNEL_SIZE, 32); |
| 0 | 33 | | outlineSettings.blurSize = 1.5f; |
| 0 | 34 | | outlineSettings.blurSigma = 5.5f; |
| 0 | 35 | | outlineSettings.outlineThickness = 0.75f; |
| 0 | 36 | | break; |
| | 37 | | case ShaderQuality.HIGH: |
| 0 | 38 | | Shader.SetGlobalInt(GAUSSIAN_BLUR_KERNEL_SIZE, 64); |
| 0 | 39 | | outlineSettings.blurSize = 2; |
| 0 | 40 | | outlineSettings.blurSigma = 6; |
| 0 | 41 | | outlineSettings.outlineThickness = 1; |
| 0 | 42 | | break; |
| 0 | 43 | | default: throw new ArgumentOutOfRangeException(); |
| | 44 | | } |
| | 45 | | } |
| | 46 | | } |
| | 47 | | } |