IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
AntialiasingEditor.cs
1 using System;
2 using UnityEditor;
3 using UnityEngine;
4 
5 namespace UnityStandardAssets.ImageEffects
6 {
7  [CustomEditor(typeof (Antialiasing))]
8  public class AntialiasingEditor : Editor
9  {
10  private SerializedObject serObj;
11 
12  private SerializedProperty mode;
13 
14  private SerializedProperty showGeneratedNormals;
15  private SerializedProperty offsetScale;
16  private SerializedProperty blurRadius;
17  private SerializedProperty dlaaSharp;
18 
19  private SerializedProperty edgeThresholdMin;
20  private SerializedProperty edgeThreshold;
21  private SerializedProperty edgeSharpness;
22 
23 
24  private void OnEnable()
25  {
26  serObj = new SerializedObject(target);
27 
28  mode = serObj.FindProperty("mode");
29 
30  showGeneratedNormals = serObj.FindProperty("showGeneratedNormals");
31  offsetScale = serObj.FindProperty("offsetScale");
32  blurRadius = serObj.FindProperty("blurRadius");
33  dlaaSharp = serObj.FindProperty("dlaaSharp");
34 
35  edgeThresholdMin = serObj.FindProperty("edgeThresholdMin");
36  edgeThreshold = serObj.FindProperty("edgeThreshold");
37  edgeSharpness = serObj.FindProperty("edgeSharpness");
38  }
39 
40 
41  public override void OnInspectorGUI()
42  {
43  serObj.Update();
44 
45  GUILayout.Label("Luminance based fullscreen antialiasing", EditorStyles.miniBoldLabel);
46 
47  EditorGUILayout.PropertyField(mode, new GUIContent("Technique"));
48 
49  Material mat = (target as Antialiasing).CurrentAAMaterial();
50  if (null == mat && (target as Antialiasing).enabled)
51  {
52  EditorGUILayout.HelpBox("This AA technique is currently not supported. Choose a different technique or disable the effect and use MSAA instead.", MessageType.Warning);
53  }
54 
55  if (mode.enumValueIndex == (int) AAMode.NFAA)
56  {
57  EditorGUILayout.PropertyField(offsetScale, new GUIContent("Edge Detect Ofs"));
58  EditorGUILayout.PropertyField(blurRadius, new GUIContent("Blur Radius"));
59  EditorGUILayout.PropertyField(showGeneratedNormals, new GUIContent("Show Normals"));
60  }
61  else if (mode.enumValueIndex == (int) AAMode.DLAA)
62  {
63  EditorGUILayout.PropertyField(dlaaSharp, new GUIContent("Sharp"));
64  }
65  else if (mode.enumValueIndex == (int) AAMode.FXAA3Console)
66  {
67  EditorGUILayout.PropertyField(edgeThresholdMin, new GUIContent("Edge Min Threshhold"));
68  EditorGUILayout.PropertyField(edgeThreshold, new GUIContent("Edge Threshhold"));
69  EditorGUILayout.PropertyField(edgeSharpness, new GUIContent("Edge Sharpness"));
70  }
71 
72  serObj.ApplyModifiedProperties();
73  }
74  }
75 }
A Utility class for performing various image based rendering tasks.
Definition: ImageEffects.cs:8