forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEyeAdaptationModelEditor.cs
More file actions
executable file
·70 lines (59 loc) · 3.05 KB
/
Copy pathEyeAdaptationModelEditor.cs
File metadata and controls
executable file
·70 lines (59 loc) · 3.05 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
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_ExposureCompensation;
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_ExposureCompensation = FindSetting((Settings x) => x.exposureCompensation);
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);
return;
}
EditorGUILayout.PropertyField(m_LogMin, EditorGUIHelper.GetContent("Histogram Log Min"));
EditorGUILayout.PropertyField(m_LogMax, EditorGUIHelper.GetContent("Histogram Log Max"));
EditorGUILayout.Space();
float low = m_LowPercent.floatValue;
float high = m_HighPercent.floatValue;
EditorGUILayout.MinMaxSlider(EditorGUIHelper.GetContent("Filter|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);
EditorGUILayout.PropertyField(m_MaxLuminance);
EditorGUILayout.PropertyField(m_ExposureCompensation);
EditorGUILayout.PropertyField(m_AdaptationType);
if (m_AdaptationType.intValue == (int)EyeAdaptationModel.EyeAdaptationType.Progressive)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_SpeedUp);
EditorGUILayout.PropertyField(m_SpeedDown);
EditorGUI.indentLevel--;
}
}
}
}