2 using UnityEngine
.Rendering
.PostProcessing
;
4 namespace UnityEditor
.Rendering
.PostProcessing
6 [PostProcessEditor(typeof(AutoExposure
))]
7 internal sealed class AutoExposureEditor
: PostProcessEffectEditor
<AutoExposure
>
9 SerializedParameterOverride m_Filtering
;
11 SerializedParameterOverride m_MinLuminance
;
12 SerializedParameterOverride m_MaxLuminance
;
13 SerializedParameterOverride m_KeyValue
;
15 SerializedParameterOverride m_EyeAdaptation
;
16 SerializedParameterOverride m_SpeedUp
;
17 SerializedParameterOverride m_SpeedDown
;
19 public override void OnEnable()
21 m_Filtering
= FindParameterOverride(x
=> x
.filtering
);
23 m_MinLuminance
= FindParameterOverride(x
=> x
.minLuminance
);
24 m_MaxLuminance
= FindParameterOverride(x
=> x
.maxLuminance
);
25 m_KeyValue
= FindParameterOverride(x
=> x
.keyValue
);
27 m_EyeAdaptation
= FindParameterOverride(x
=> x
.eyeAdaptation
);
28 m_SpeedUp
= FindParameterOverride(x
=> x
.speedUp
);
29 m_SpeedDown
= FindParameterOverride(x
=> x
.speedDown
);
32 public override void OnInspectorGUI()
34 if (!SystemInfo
.supportsComputeShaders
)
35 EditorGUILayout
.HelpBox("Auto exposure requires compute shader support.", MessageType
.Warning
);
37 EditorUtilities
.DrawHeaderLabel("Exposure");
39 PropertyField(m_Filtering
);
40 PropertyField(m_MinLuminance
);
41 PropertyField(m_MaxLuminance
);
43 // Clamp min/max adaptation values
44 float minLum
= m_MinLuminance
.value.floatValue
;
45 float maxLum
= m_MaxLuminance
.value.floatValue
;
46 m_MinLuminance
.value.floatValue
= Mathf
.Min(minLum
, maxLum
);
47 m_MaxLuminance
.value.floatValue
= Mathf
.Max(minLum
, maxLum
);
49 PropertyField(m_KeyValue
);
51 EditorGUILayout
.Space();
52 EditorUtilities
.DrawHeaderLabel("Adaptation");
54 PropertyField(m_EyeAdaptation
);
56 if (m_EyeAdaptation
.value.intValue
== (int)EyeAdaptation
.Progressive
)
58 PropertyField(m_SpeedUp
);
59 PropertyField(m_SpeedDown
);