namespace UnityEngine.Rendering.HighDefinition { /// /// A base class for volume components that use quality settings and HDRP scalable settings to adjust their behavior based on performance tiers. /// /// /// This class is designed for volume components that need to change their parameters based on the selected quality level and scalable settings /// public abstract class VolumeComponentWithQuality : VolumeComponent { /// /// Specifies the quality level to be used for performance-relevant parameters. The quality level will adjust /// the component's behavior based on the selected setting, which helps to optimize performance across different /// hardware configurations. /// /// /// This parameter allows the user to specify the quality tier (e.g., Low, Medium, High) for specific components /// that are performance-sensitive. By modifying this parameter, you can tailor the visual fidelity of the component /// to meet performance requirements. /// [Tooltip("Specifies the quality level to be used for performance relevant parameters.")] [InspectorName("Tier")] public ScalableSettingLevelParameter quality = new ScalableSettingLevelParameter((int)ScalableSettingLevelParameter.Level.Medium, false); /// /// Retrieves the post-processing quality settings from the current pipeline, if available. /// /// /// This method checks the active render pipeline and returns the post-processing quality settings, which determine /// how post-processing effects are applied depending on the selected quality level. /// /// The object, or null if unavailable. static internal GlobalPostProcessingQualitySettings GetPostProcessingQualitySettings() { var pipeline = (HDRenderPipeline)RenderPipelineManager.currentPipeline; if (pipeline != null) { return pipeline.currentPlatformRenderPipelineSettings.postProcessQualitySettings; } // This shouldn't happen ever. return null; } /// /// Retrieves the lighting quality settings from the current pipeline, if available. /// /// /// This method retrieves the lighting quality settings from the active render pipeline. These settings control /// how lighting is processed and rendered depending on the quality level. /// /// The object, or null if unavailable. static internal GlobalLightingQualitySettings GetLightingQualitySettings() { var pipeline = (HDRenderPipeline)RenderPipelineManager.currentPipeline; if (pipeline != null) { return pipeline.currentPlatformRenderPipelineSettings.lightingQualitySettings; } // This shouldn't happen ever. return null; } /// /// Determines if the component is using parameters from the quality settings. /// /// /// This method checks whether the component uses the current quality settings or whether it is overridden by /// a custom setting. If the component uses the default quality settings, it will return true. /// /// True if the component uses the quality settings; otherwise, false. /// /// // Example of usage: /// if (UsesQualitySettings()) /// { /// // Adjust parameters based on quality settings /// } /// protected bool UsesQualitySettings() { return !quality.levelAndOverride.useOverride && (HDRenderPipeline)RenderPipelineManager.currentPipeline != null; } } }