StaticOcclusionCulling lets you perform static occlusion culling operations.

Пример #1
0
        private void BakeButtons()
        {
            float width = 95f;

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            bool flag = !EditorApplication.isPlayingOrWillChangePlaymode;

            GUI.enabled = StaticOcclusionCulling.umbraDataSize != 0 && flag;
            if (GUILayout.Button("Clear", new GUILayoutOption[1] {
                GUILayout.Width(width)
            }))
            {
                StaticOcclusionCulling.Clear();
            }
            GUI.enabled = flag;
            if (StaticOcclusionCulling.isRunning)
            {
                if (GUILayout.Button("Cancel", new GUILayoutOption[1] {
                    GUILayout.Width(width)
                }))
                {
                    StaticOcclusionCulling.Cancel();
                }
            }
            else if (GUILayout.Button("Bake", new GUILayoutOption[1] {
                GUILayout.Width(width)
            }))
            {
                StaticOcclusionCulling.GenerateInBackground();
            }
            GUILayout.EndHorizontal();
            GUI.enabled = true;
        }
Пример #2
0
        private void BakeSettings()
        {
            if (GUILayout.Button("Set default parameters", new GUILayoutOption[1] {
                GUILayout.Width(150f)
            }))
            {
                GUIUtility.keyboardControl = 0;
                StaticOcclusionCulling.SetDefaultOcclusionBakeSettings();
            }
            GUILayout.Label(OcclusionCullingWindow.s_Styles.defaultParameterText.tooltip, EditorStyles.helpBox, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            float num1 = EditorGUILayout.FloatField(OcclusionCullingWindow.s_Styles.smallestOccluder, StaticOcclusionCulling.smallestOccluder, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                StaticOcclusionCulling.smallestOccluder = num1;
            }
            EditorGUI.BeginChangeCheck();
            float num2 = EditorGUILayout.FloatField(OcclusionCullingWindow.s_Styles.smallestHole, StaticOcclusionCulling.smallestHole, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                StaticOcclusionCulling.smallestHole = num2;
            }
            EditorGUI.BeginChangeCheck();
            float num3 = EditorGUILayout.Slider(OcclusionCullingWindow.s_Styles.backfaceThreshold, StaticOcclusionCulling.backfaceThreshold, 5f, 100f, new GUILayoutOption[0]);

            if (!EditorGUI.EndChangeCheck())
            {
                return;
            }
            StaticOcclusionCulling.backfaceThreshold = num3;
        }
Пример #3
0
        private void BakeSettings()
        {
            float width = 150f;

            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(width) };
            if (GUILayout.Button("Set default parameters", options))
            {
                GUIUtility.keyboardControl = 0;
                StaticOcclusionCulling.SetDefaultOcclusionBakeSettings();
            }
            GUILayout.Label(s_Styles.defaultParameterText.tooltip, EditorStyles.helpBox, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            float num2 = EditorGUILayout.FloatField(s_Styles.smallestOccluder, StaticOcclusionCulling.smallestOccluder, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                StaticOcclusionCulling.smallestOccluder = num2;
            }
            EditorGUI.BeginChangeCheck();
            float num3 = EditorGUILayout.FloatField(s_Styles.smallestHole, StaticOcclusionCulling.smallestHole, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                StaticOcclusionCulling.smallestHole = num3;
            }
            EditorGUI.BeginChangeCheck();
            float num4 = EditorGUILayout.Slider(s_Styles.backfaceThreshold, StaticOcclusionCulling.backfaceThreshold, 5f, 100f, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                StaticOcclusionCulling.backfaceThreshold = num4;
            }
        }
        void BakeSettings()
        {
            // Button for setting default values
            float buttonWidth = 150;

            if (GUILayout.Button("Set default parameters", GUILayout.Width(buttonWidth)))
            {
                Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Set Default Parameters");
                GUIUtility.keyboardControl = 0; // Force focus out from potentially selected field for default parameters setting
                StaticOcclusionCulling.SetDefaultOcclusionBakeSettings();
            }

            // Label for default parameter setting
            GUILayout.Label(s_Styles.defaultParameterText.tooltip, EditorStyles.helpBox);

            // Edit Smallest Occluder
            EditorGUI.BeginChangeCheck();
            float smallestOccluder = EditorGUILayout.FloatField(s_Styles.smallestOccluder, StaticOcclusionCulling.smallestOccluder);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Change Smallest Occluder");
                StaticOcclusionCulling.smallestOccluder = smallestOccluder;
            }

            // Edit smallest hole
            EditorGUI.BeginChangeCheck();
            float smallestHole = EditorGUILayout.FloatField(s_Styles.smallestHole, StaticOcclusionCulling.smallestHole);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Change Smallest Hole");
                StaticOcclusionCulling.smallestHole = smallestHole;
            }

            // Edit backface threshold
            EditorGUI.BeginChangeCheck();
            float backfaceThreshold = EditorGUILayout.Slider(s_Styles.backfaceThreshold, StaticOcclusionCulling.backfaceThreshold, 5.0F, 100.0F);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(StaticOcclusionCulling.occlusionCullingSettings, "Change Backface Threshold");
                StaticOcclusionCulling.backfaceThreshold = backfaceThreshold;
            }
        }
        void BakeButtons()
        {
            float buttonWidth = 95;

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            bool allowBaking = !EditorApplication.isPlayingOrWillChangePlaymode;
            bool bakeRunning = StaticOcclusionCulling.isRunning;

            GUI.enabled = !bakeRunning && allowBaking;
            if (CustomDropdownButton("Clear", buttonWidth))
            {
                if (m_ClearBakeData)
                {
                    StaticOcclusionCulling.Clear();
                }

                if (m_ClearCacheData)
                {
                    StaticOcclusionCulling.RemoveCacheFolder();
                }
            }

            GUI.enabled = allowBaking;
            if (bakeRunning)
            {
                if (GUILayout.Button("Cancel", GUILayout.Width(buttonWidth)))
                {
                    StaticOcclusionCulling.Cancel();
                }
            }
            else
            {
                if (GUILayout.Button("Bake", GUILayout.Width(buttonWidth)))
                {
                    StaticOcclusionCulling.GenerateInBackground();
                }
            }

            GUILayout.EndHorizontal();
            GUI.enabled = true;
        }
        void BakeButtons()
        {
            float buttonWidth = 95;

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            bool allowBaking = !EditorApplication.isPlayingOrWillChangePlaymode;

            // Clear Tome button
            GUI.enabled = StaticOcclusionCulling.umbraDataSize != 0 && allowBaking;
            if (GUILayout.Button("Clear", GUILayout.Width(buttonWidth)))
            {
                StaticOcclusionCulling.Clear();
            }
            GUI.enabled = allowBaking;

            // Is occlusion culling running
            if (StaticOcclusionCulling.isRunning)
            {
                if (GUILayout.Button("Cancel", GUILayout.Width(buttonWidth)))
                {
                    StaticOcclusionCulling.Cancel();
                }
            }
            else
            {
                if (GUILayout.Button("Bake", GUILayout.Width(buttonWidth)))
                {
                    StaticOcclusionCulling.GenerateInBackground();
                }
            }

            GUILayout.EndHorizontal();

            GUI.enabled = true;
        }
 void OnDidOpenScene()
 {
     StaticOcclusionCulling.InvalidatePrevisualisationData();
     Repaint();
 }