EyeAdaptationModelEditor.cs
3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using UnityEngine;
using UnityEngine.PostProcessing;
namespace UnityEditor.PostProcessing
{
using Settings = EyeAdaptationModel.Settings;
[PostProcessingModelEditor(typeof(EyeAdaptationModel))]
public class EyeAdaptationModelEditor : PostProcessingModelEditor
{
SerializedProperty m_LowPercent;
SerializedProperty m_HighPercent;
SerializedProperty m_MinLuminance;
SerializedProperty m_MaxLuminance;
SerializedProperty m_KeyValue;
SerializedProperty m_DynamicKeyValue;
SerializedProperty m_AdaptationType;
SerializedProperty m_SpeedUp;
SerializedProperty m_SpeedDown;
SerializedProperty m_LogMin;
SerializedProperty m_LogMax;
public override void OnEnable()
{
m_LowPercent = FindSetting((Settings x) => x.lowPercent);
m_HighPercent = FindSetting((Settings x) => x.highPercent);
m_MinLuminance = FindSetting((Settings x) => x.minLuminance);
m_MaxLuminance = FindSetting((Settings x) => x.maxLuminance);
m_KeyValue = FindSetting((Settings x) => x.keyValue);
m_DynamicKeyValue = FindSetting((Settings x) => x.dynamicKeyValue);
m_AdaptationType = FindSetting((Settings x) => x.adaptationType);
m_SpeedUp = FindSetting((Settings x) => x.speedUp);
m_SpeedDown = FindSetting((Settings x) => x.speedDown);
m_LogMin = FindSetting((Settings x) => x.logMin);
m_LogMax = FindSetting((Settings x) => x.logMax);
}
public override void OnInspectorGUI()
{
if (!GraphicsUtils.supportsDX11)
EditorGUILayout.HelpBox("This effect requires support for compute shaders. Enabling it won't do anything on unsupported platforms.", MessageType.Warning);
EditorGUILayout.LabelField("Luminosity range", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_LogMin, EditorGUIHelper.GetContent("Minimum (EV)"));
EditorGUILayout.PropertyField(m_LogMax, EditorGUIHelper.GetContent("Maximum (EV)"));
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.LabelField("Auto exposure", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
float low = m_LowPercent.floatValue;
float high = m_HighPercent.floatValue;
EditorGUILayout.MinMaxSlider(EditorGUIHelper.GetContent("Histogram filtering|These values are the lower and upper percentages of the histogram that will be used to find a stable average luminance. Values outside of this range will be discarded and won't contribute to the average luminance."), ref low, ref high, 1f, 99f);
m_LowPercent.floatValue = low;
m_HighPercent.floatValue = high;
EditorGUILayout.PropertyField(m_MinLuminance, EditorGUIHelper.GetContent("Minimum (EV)"));
EditorGUILayout.PropertyField(m_MaxLuminance, EditorGUIHelper.GetContent("Maximum (EV)"));
EditorGUILayout.PropertyField(m_DynamicKeyValue);
if (!m_DynamicKeyValue.boolValue)
EditorGUILayout.PropertyField(m_KeyValue);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.LabelField("Adaptation", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_AdaptationType, EditorGUIHelper.GetContent("Type"));
if (m_AdaptationType.intValue == (int)EyeAdaptationModel.EyeAdaptationType.Progressive)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_SpeedUp);
EditorGUILayout.PropertyField(m_SpeedDown);
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;
}
}
}