< Summary

Class:DCL.SettingsData.QualitySettingsData
Assembly:Settings
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/QualitySettingsData.cs
Covered lines:0
Uncovered lines:5
Coverable lines:5
Total lines:125
Line coverage:0% (0 of 5)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Set(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Settings/QualitySettingsData.cs

#LineLine coverage
 1using UnityEngine;
 2using System;
 3using DCL.Helpers;
 4using UnityEngine.Serialization;
 5
 6namespace DCL.SettingsData
 7{
 8    [CreateAssetMenu(fileName = "QualitySettings", menuName = "QualitySettings")]
 9    public class QualitySettingsData : ScriptableObject
 10    {
 11        [SerializeField] int defaultPresetIndex = 0;
 12        [SerializeField] QualitySettings[] settings = null;
 13
 014        public QualitySettings this[int i] { get { return settings[i]; } }
 15
 016        public int Length { get { return settings.Length; } }
 17
 018        public QualitySettings defaultPreset { get { return settings[defaultPresetIndex]; } }
 19
 020        public int defaultIndex { get { return defaultPresetIndex; } }
 21
 022        public void Set(QualitySettings[] newSettings) { settings = newSettings; }
 23    }
 24
 25    [Serializable]
 26    public struct QualitySettings
 27    {
 28        public enum BaseResolution
 29        {
 30            BaseRes_720,
 31            BaseRes_1080,
 32            BaseRes_Unlimited
 33        }
 34
 35        public enum SSAOQualityLevel
 36        {
 37            OFF,
 38            LOW,
 39            MID,
 40            HIGH
 41        }
 42
 43        public string displayName;
 44
 45        [Tooltip("Base resolution level")]
 46        public BaseResolution baseResolution;
 47
 48        [Tooltip("Controls the global anti aliasing setting")]
 49        public UnityEngine.Rendering.Universal.MsaaQuality antiAliasing;
 50
 51        [Tooltip("Scales the camera render target allowing the game to render at a resolution different than native reso
 52        public float renderScale;
 53
 54        [Tooltip("If enabled the main light can be a shadow casting light")]
 55        public bool shadows;
 56
 57        [Tooltip("If enabled pipeline will perform shadow filterin. Otherwise all lights that cast shadows will fallback
 58        public bool softShadows;
 59
 60        [Tooltip("Resolution of the main light shadowmap texture")]
 61        public UnityEngine.Rendering.Universal.ShadowResolution shadowResolution;
 62
 63        [Tooltip("Camera Far")] [Range(40, 500)]
 64        public float cameraDrawDistance;
 65
 66        [Tooltip("Enable bloom post process")]
 67        public bool bloom;
 68
 69        [Tooltip("Enable 30 FPS capping for more stable framerate")]
 70        public bool fpsCap;
 71
 72        [Tooltip("Enable color grading post process")]
 73        public bool colorGrading;
 74
 75        [Tooltip("Shadow Distance")] [Range(30, 100)]
 76        public float shadowDistance;
 77
 78        [Tooltip("Enable culling for detail objects in the viewport.")]
 79        public bool enableDetailObjectCulling;
 80
 81        [Tooltip("If detail object culling is ON, this slider determines the relative size of culled objects from tiny t
 82        public float detailObjectCullingLimit;
 83
 84        [Tooltip("SSAO quality level")]
 85        public SSAOQualityLevel ssaoQuality;
 86
 87        public bool Equals(QualitySettings otherSetting)
 88        {
 89            // The precision is set to 1 because the wholeNumbers setting
 90            // in the slider can clamp the values, thus we can have a 0 > n > 1 precision error.
 91            const float comparePrecision = 1.0f;
 92
 93            if (baseResolution != otherSetting.baseResolution)
 94                return false;
 95            if (antiAliasing != otherSetting.antiAliasing)
 96                return false;
 97            if (Mathf.Abs(renderScale - otherSetting.renderScale) > 0.001f)
 98                return false;
 99            if (shadows != otherSetting.shadows)
 100                return false;
 101            if (softShadows != otherSetting.softShadows)
 102                return false;
 103            if (shadowResolution != otherSetting.shadowResolution)
 104                return false;
 105            if (!Utils.CompareFloats(cameraDrawDistance, otherSetting.cameraDrawDistance, comparePrecision))
 106                return false;
 107            if (bloom != otherSetting.bloom)
 108                return false;
 109            if (fpsCap != otherSetting.fpsCap)
 110                return false;
 111            if (colorGrading != otherSetting.colorGrading)
 112                return false;
 113            if (!Utils.CompareFloats(shadowDistance, otherSetting.shadowDistance, comparePrecision))
 114                return false;
 115            if (enableDetailObjectCulling != otherSetting.enableDetailObjectCulling)
 116                return false;
 117            if (!Utils.CompareFloats(detailObjectCullingLimit, otherSetting.detailObjectCullingLimit, comparePrecision))
 118                return false;
 119            if (ssaoQuality != otherSetting.ssaoQuality)
 120                return false;
 121
 122            return true;
 123        }
 124    }
 125}