12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- namespace UnityEngine.AdaptivePerformance
- {
- /// <summary>
- /// A scaler used by <see cref="AdaptivePerformanceIndexer"/> to adjust the size of the palette used for color grading in URP.
- /// </summary>
- public class AdaptiveLut : AdaptivePerformanceScaler
- {
- float m_DefaultLutBias;
-
- /// <summary>
- /// Ensures settings are applied during startup.
- /// </summary>
- protected override void Awake()
- {
- base.Awake();
- if (m_Settings == null)
- return;
- ApplyDefaultSetting(m_Settings.scalerSettings.AdaptiveLut);
- }
-
- /// <summary>
- /// Callback when scaler gets disabled and removed from indexer
- /// </summary>
- protected override void OnDisabled()
- {
- AdaptivePerformanceRenderSettings.LutBias = m_DefaultLutBias;
- }
-
- /// <summary>
- /// Callback when scaler gets enabled and added to the indexer
- /// </summary>
- protected override void OnEnabled()
- {
- m_DefaultLutBias = AdaptivePerformanceRenderSettings.LutBias;
- }
-
- /// <summary>
- /// Callback for any level change.
- /// </summary>
- protected override void OnLevel()
- {
- if (ScaleChanged())
- AdaptivePerformanceRenderSettings.LutBias = Scale;
- }
- }
- }
|