static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        string[] entries = System.Array.FindAll(importedAssets, name => name.Contains("SSAOPro_StartupWindow") && !name.EndsWith(".meta"));

        for (int i = 0; i < entries.Length; i++)
        {
            if (SSAOPro_StartupWindow.Init(false))
            {
                break;
            }
        }
    }
 public static void MenuInit()
 {
     SSAOPro_StartupWindow.Init(true);
 }
Ejemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        Texture2D noise = (Texture2D)p_noiseTexture.objectReferenceValue;

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Noise Texture");
        EditorGUILayout.BeginHorizontal();
        noise = (Texture2D)EditorGUILayout.ObjectField(noise, typeof(Texture2D), false);
        if (GUILayout.Button("D", EditorStyles.miniButtonLeft))
        {
            noise = Resources.Load <Texture2D>("noise");
        }
        if (GUILayout.Button("N", EditorStyles.miniButtonRight))
        {
            noise = null;
        }
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndHorizontal();

        p_noiseTexture.objectReferenceValue = noise;

#if UNITY_4_X
        EditorGUILayout.PropertyField(p_useHighPrecisionDepthMap, new GUIContent("High Precision Depth Map", "Use a higher precision depth map. Slower but higher quality. Only use when working with the Forward rendering path in Unity 4.x"));

        if (p_useHighPrecisionDepthMap.boolValue)
        {
            RenderingPath rpath = (target as SSAOPro).GetComponent <Camera>().actualRenderingPath;

            if (rpath != RenderingPath.Forward && rpath != RenderingPath.VertexLit)
            {
                EditorGUILayout.HelpBox("High Precision Depth Map should only be used when working with the Forward rendering path in Unity 4.x !", MessageType.Warning);
            }
        }
#endif

        EditorGUILayout.PropertyField(p_samples, new GUIContent("Sample Count", "Number of ambient occlusion samples (higher is slower)"));
        EditorGUILayout.PropertyField(p_downsampling, new GUIContent("Downsampling", "The resolution at which calculations should be performed (for example, a downsampling value of 2 will work at half the screen resolution)"));
        EditorGUILayout.PropertyField(p_intensity, new GUIContent("Intensity", "Occlusion multiplier (degree of darkness added by ambient occlusion)"));
        EditorGUILayout.PropertyField(p_radius, new GUIContent("Radius", "Sampling radius (in world unit)"));
        EditorGUILayout.PropertyField(p_distance, new GUIContent("Distance", "Distance between an occluded sample and its occluder"));
        EditorGUILayout.PropertyField(p_bias, new GUIContent("Bias", "Adds to the width of the occlusion cone (push this up to reduce artifacts)"));
        EditorGUILayout.PropertyField(p_lumContribution, new GUIContent("Lighting Contribution", "Uses the pixel luminosity to reduce ambient occlusion in bright areas"));
        EditorGUILayout.PropertyField(p_occlusionColor, new GUIContent("Occlusion Color", "Color to use for the occluded areas (pure black leads to better performances)"));

        EditorGUILayout.PropertyField(p_blur, new GUIContent("Blur Type", "Type of blur to apply to the ambient occlusion pass"));

        if (p_blur.intValue != (int)SSAOPro.BlurMode.None)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(p_blurDownsampling, new GUIContent("Blur Downsampling", "The resolution at which the blur should be performed, see the Downsampling parameter"));
            EditorGUILayout.PropertyField(p_blurPasses, new GUIContent("Blur Passes", "The number of blur passes to apply (more means smoother but slower)"));

            if (p_blur.intValue == (int)SSAOPro.BlurMode.HighQualityBilateral)
            {
                EditorGUILayout.PropertyField(p_blurBilateralThreshold, new GUIContent("Depth Threshold", "Threshold used to compare the depth of each fragment (blur sharpness)"));
            }

            EditorGUI.indentLevel--;
        }

        EditorGUILayout.LabelField("Distance Cutoff", EditorStyles.boldLabel);
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(p_cutoffDistance, new GUIContent("Max Distance", "Stops applying ambient occlusion for samples over this depth (in world unit)"));
        EditorGUILayout.PropertyField(p_cutoffFalloff, new GUIContent("Falloff", "Starts fading the ambient occlusion X units before the Max Distance has been reached (in world unit)"));
        EditorGUI.indentLevel--;

        p_debugAO.boolValue = GUILayout.Toggle(p_debugAO.boolValue, "Show AO", EditorStyles.miniButton);

        if (GUILayout.Button("About", EditorStyles.miniButton))
        {
            SSAOPro_StartupWindow.Init(true);
        }

        serializedObject.ApplyModifiedProperties();
    }