您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
64 行
2.3 KiB
64 行
2.3 KiB
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
[CustomEditor (typeof(Antialiasing))]
|
|
public class AntialiasingEditor : Editor {
|
|
|
|
SerializedObject serObj;
|
|
|
|
SerializedProperty mode;
|
|
|
|
SerializedProperty showGeneratedNormals;
|
|
SerializedProperty offsetScale;
|
|
SerializedProperty blurRadius;
|
|
SerializedProperty dlaaSharp;
|
|
|
|
SerializedProperty edgeThresholdMin;
|
|
SerializedProperty edgeThreshold;
|
|
SerializedProperty edgeSharpness;
|
|
|
|
void OnEnable ()
|
|
{
|
|
serObj = new SerializedObject (target);
|
|
|
|
mode = serObj.FindProperty ("mode");
|
|
|
|
showGeneratedNormals = serObj.FindProperty ("showGeneratedNormals");
|
|
offsetScale = serObj.FindProperty ("offsetScale");
|
|
blurRadius = serObj.FindProperty ("blurRadius");
|
|
dlaaSharp = serObj.FindProperty ("dlaaSharp");
|
|
|
|
edgeThresholdMin = serObj.FindProperty("edgeThresholdMin");
|
|
edgeThreshold = serObj.FindProperty("edgeThreshold");
|
|
edgeSharpness = serObj.FindProperty("edgeSharpness");
|
|
}
|
|
|
|
|
|
public override void OnInspectorGUI ()
|
|
{
|
|
serObj.Update ();
|
|
|
|
GUILayout.Label("Luminance based fullscreen antialiasing", EditorStyles.miniBoldLabel);
|
|
|
|
EditorGUILayout.PropertyField (mode, new GUIContent ("Technique"));
|
|
|
|
Material mat = (target as Antialiasing).CurrentAAMaterial ();
|
|
if(null == mat && (target as Antialiasing).enabled) {
|
|
EditorGUILayout.HelpBox("This AA technique is currently not supported. Choose a different technique or disable the effect and use MSAA instead.", MessageType.Warning);
|
|
}
|
|
|
|
if (mode.enumValueIndex == (decimal) AAMode.NFAA) {
|
|
EditorGUILayout.PropertyField (offsetScale, new GUIContent ("Edge Detect Ofs"));
|
|
EditorGUILayout.PropertyField (blurRadius, new GUIContent ("Blur Radius"));
|
|
EditorGUILayout.PropertyField (showGeneratedNormals, new GUIContent ("Show Normals"));
|
|
} else if (mode.enumValueIndex == (decimal) AAMode.DLAA) {
|
|
EditorGUILayout.PropertyField (dlaaSharp, new GUIContent ("Sharp"));
|
|
} else if (mode.enumValueIndex == (decimal) AAMode.FXAA3Console) {
|
|
EditorGUILayout.PropertyField (edgeThresholdMin, new GUIContent ("Edge Min Threshhold"));
|
|
EditorGUILayout.PropertyField (edgeThreshold, new GUIContent ("Edge Threshhold"));
|
|
EditorGUILayout.PropertyField (edgeSharpness, new GUIContent ("Edge Sharpness"));
|
|
}
|
|
|
|
serObj.ApplyModifiedProperties();
|
|
}
|
|
}
|