public void BeginBake()
        {
            Sphere  bakeSphere;
            Vector3 sphereCenter = Common.ConvertVector(gameObject.transform.position);

            bakeSphere.centerx = sphereCenter.x;
            bakeSphere.centery = sphereCenter.y;
            bakeSphere.centerz = sphereCenter.z;
            bakeSphere.radius  = bakingRadius;

            GameObject[] bakeObjects = { gameObject };
            BakingMode[] bakingModes = { BakingMode.StaticListener };
            string[]     bakeStrings = { uniqueIdentifier };
            Sphere[]     bakeSpheres = { bakeSphere };

            ProbeBox[][] bakeProbeBoxes;
            bakeProbeBoxes = new ProbeBox[1][];

            if (useAllProbeBoxes)
            {
                bakeProbeBoxes[0] = FindObjectsOfType <ProbeBox>() as ProbeBox[];
            }
            else
            {
                bakeProbeBoxes[0] = probeBoxes;
            }

            phononBaker.BeginBake(bakeObjects, bakingModes, bakeStrings, bakeSpheres, bakeProbeBoxes);
        }
        //
        // Draws the inspector GUI.
        //
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            string[] placementStrategyString   = { "Centroid", "Uniform Floor" };
            var      placementStrategyProperty = serializedObject.FindProperty("placementStrategy");
            int      enumValueIndex            = (placementStrategyProperty.enumValueIndex > 0) ? 1 : 0;

            enumValueIndex = EditorGUILayout.Popup("Placement Strategy", enumValueIndex, placementStrategyString);
            placementStrategyProperty.enumValueIndex = (enumValueIndex > 0) ? 2 : 0;

            if (serializedObject.FindProperty("placementStrategy").intValue == (int)ProbePlacementStrategy.Octree)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("maxNumTriangles"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("maxOctreeDepth"));
            }
            else if (serializedObject.FindProperty("placementStrategy").intValue == (int)ProbePlacementStrategy.UniformFloor)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("horizontalSpacing"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("heightAboveFloor"));
            }

            ProbeBox probeBox = serializedObject.targetObject as ProbeBox;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(" ");
            if (GUILayout.Button("Generate Probes"))
            {
                probeBox.GenerateProbes();
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
            }
            EditorGUILayout.EndHorizontal();

            if (probeBox.probeSpherePoints != null && probeBox.probeSpherePoints.Length != 0)
            {
                PhononGUI.SectionHeader("Probe Box Statistics");
                EditorGUILayout.LabelField("Probe Points", (probeBox.probeSpherePoints.Length / 3).ToString());
                EditorGUILayout.LabelField("Probe Data Size", (probeBox.probeBoxData.Length / 1000.0f).ToString("0.0") + " KB");
            }

            for (int i = 0; i < probeBox.probeDataName.Count; ++i)
            {
                if (i == 0)
                {
                    PhononGUI.SectionHeader("Detailed Statistics");
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(probeBox.probeDataName[i], (probeBox.probeDataNameSizes[i] / 1000.0f).ToString("0.0") + " KB");
                if (GUILayout.Button("Clear"))
                {
                    probeBox.DeleteBakedDataByName(probeBox.probeDataName[i]);
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();
            serializedObject.ApplyModifiedProperties();
        }
Beispiel #3
0
        public void BeginBake()
        {
            GameObject[] bakeObjects = { gameObject };
            BakingMode[] bakingModes = { BakingMode.Reverb };
            string[]     bakeStrings = { "__reverb__" };
            Sphere[]     bakeSpheres = { new Sphere() };

            ProbeBox[][] bakeProbeBoxes;
            bakeProbeBoxes = new ProbeBox[1][];

            if (useAllProbeBoxes)
            {
                bakeProbeBoxes[0] = FindObjectsOfType <ProbeBox>() as ProbeBox[];
            }
            else
            {
                bakeProbeBoxes[0] = probeBoxes;
            }

            phononBaker.BeginBake(bakeObjects, bakingModes, bakeStrings, bakeSpheres, bakeProbeBoxes);
        }