Example #1
0
        public override void OnInspectorGUI()
        {
            SCPE_GUI.DisplayDocumentationButton("edge-detection");

            SCPE_GUI.DisplayVRWarning();

            SCPE_GUI.DisplaySetupWarning();

            PropertyField(edgesOnly);

            PropertyField(mode);

            if (mode.overrideState.boolValue)
            {
                EditorGUILayout.BeginHorizontal();
                switch (mode.value.intValue)
                {
                case 0:
                    EditorGUILayout.HelpBox("Checks pixels for differences between geometry normals and their distance from the camera", MessageType.None);
                    break;

                case 1:
                    EditorGUILayout.HelpBox("Same as Depth Normals but also uses vertical sampling for improved accuracy", MessageType.None);
                    break;

                case 2:
                    EditorGUILayout.HelpBox("Draws edges only where neighboring pixels greatly differ in their depth value.", MessageType.None);
                    break;

                case 3:
                    EditorGUILayout.HelpBox("Creates an edge where the luminance value of a pixel differs from its neighbors, past the threshold", MessageType.None);
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }

#if LWRP
            if (mode.value.intValue < 2 && mode.overrideState.boolValue == true && RenderPipelineManager.currentPipeline != null)
            {
                EditorGUILayout.HelpBox("Not supported in LWRP", MessageType.Error);
            }
#endif

            using (new EditorGUILayout.HorizontalScope())
            {
                // Override checkbox
                var overrideRect = GUILayoutUtility.GetRect(17f, 17f, GUILayout.ExpandWidth(false));
                overrideRect.yMin += 4f;
                EditorUtilities.DrawOverrideCheckbox(overrideRect, fadeDistance.overrideState);

                EditorGUILayout.PrefixLabel(fadeDistance.displayName);

                GUILayout.FlexibleSpace();

                fadeDistance.value.floatValue = EditorGUILayout.FloatField(fadeDistance.value.floatValue);

                bool enabled = invertFadeDistance.value.boolValue;
                enabled = GUILayout.Toggle(enabled, "Start", EditorStyles.miniButtonLeft, GUILayout.Width(50f), GUILayout.ExpandWidth(false));
                enabled = !GUILayout.Toggle(!enabled, "End", EditorStyles.miniButtonRight, GUILayout.Width(50f), GUILayout.ExpandWidth(false));

                invertFadeDistance.value.boolValue = enabled;
            }

            if (mode.value.intValue < 2)
            {
                PropertyField(sensitivityDepth);
                PropertyField(sensitivityNormals);
            }
            else if (mode.value.intValue == 2)
            {
                PropertyField(edgeExp);
            }
            else
            {
                // lum based mode
                PropertyField(lumThreshold);
            }

            //Edges
            PropertyField(edgeColor);
            PropertyField(edgeOpacity);
            PropertyField(sampleDist);
            if (mode.value.intValue == 2)
            {
                PropertyField(sobelThin);
            }
        }