AntialiasingModelEditor.cs
2.7 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
using UnityEngine;
using UnityEngine.PostProcessing;
namespace UnityEditor.PostProcessing
{
using Method = AntialiasingModel.Method;
using Settings = AntialiasingModel.Settings;
[PostProcessingModelEditor(typeof(AntialiasingModel))]
public class AntialiasingModelEditor : PostProcessingModelEditor
{
SerializedProperty m_Method;
SerializedProperty m_FxaaPreset;
SerializedProperty m_TaaJitterSpread;
SerializedProperty m_TaaSharpen;
SerializedProperty m_TaaStationaryBlending;
SerializedProperty m_TaaMotionBlending;
static string[] s_MethodNames =
{
"Fast Approximate Anti-aliasing",
"Temporal Anti-aliasing"
};
public override void OnEnable()
{
m_Method = FindSetting((Settings x) => x.method);
m_FxaaPreset = FindSetting((Settings x) => x.fxaaSettings.preset);
m_TaaJitterSpread = FindSetting((Settings x) => x.taaSettings.jitterSpread);
m_TaaSharpen = FindSetting((Settings x) => x.taaSettings.sharpen);
m_TaaStationaryBlending = FindSetting((Settings x) => x.taaSettings.stationaryBlending);
m_TaaMotionBlending = FindSetting((Settings x) => x.taaSettings.motionBlending);
}
public override void OnInspectorGUI()
{
m_Method.intValue = EditorGUILayout.Popup("Method", m_Method.intValue, s_MethodNames);
if (m_Method.intValue == (int)Method.Fxaa)
{
EditorGUILayout.PropertyField(m_FxaaPreset);
}
else if (m_Method.intValue == (int)Method.Taa)
{
if (QualitySettings.antiAliasing > 1)
EditorGUILayout.HelpBox("Temporal Anti-Aliasing doesn't work correctly when MSAA is enabled.", MessageType.Warning);
EditorGUILayout.LabelField("Jitter", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_TaaJitterSpread, EditorGUIHelper.GetContent("Spread"));
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.LabelField("Blending", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_TaaStationaryBlending, EditorGUIHelper.GetContent("Stationary"));
EditorGUILayout.PropertyField(m_TaaMotionBlending, EditorGUIHelper.GetContent("Motion"));
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.PropertyField(m_TaaSharpen);
}
}
}
}