private void LightmapPerformanceStats(int index)
        {
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("Index: " + index, EditorStyles.miniLabel, new GUILayoutOption[0]);
            LightmapConvergence lightmapConvergence = Lightmapping.GetLightmapConvergence(index);

            if (lightmapConvergence.IsValid())
            {
                GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString((ulong)((long)lightmapConvergence.occupiedTexelCount)), EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUIContent content = EditorGUIUtility.TrTextContent(string.Concat(new object[]
                {
                    "Direct: ",
                    lightmapConvergence.minDirectSamples,
                    " / ",
                    lightmapConvergence.maxDirectSamples,
                    " / ",
                    lightmapConvergence.avgDirectSamples,
                    ""
                }), "min / max / avg samples per texel", null);
                GUILayout.Label(content, EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUIContent content2 = EditorGUIUtility.TrTextContent(string.Concat(new object[]
                {
                    "GI: ",
                    lightmapConvergence.minGISamples,
                    " / ",
                    lightmapConvergence.maxGISamples,
                    " / ",
                    lightmapConvergence.avgGISamples,
                    ""
                }), "min / max / avg samples per texel", null);
                GUILayout.Label(content2, EditorStyles.miniLabel, new GUILayoutOption[0]);
            }
            else
            {
                GUILayout.Label("Occupied: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUILayout.Label("Direct: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]);
                GUILayout.Label("GI: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]);
            }
            float lightmapBakePerformance = Lightmapping.GetLightmapBakePerformance(index);

            if ((double)lightmapBakePerformance >= 0.0)
            {
                GUILayout.Label(lightmapBakePerformance.ToString("0.00") + " mrays/sec", EditorStyles.miniLabel, new GUILayoutOption[0]);
            }
            else
            {
                GUILayout.Label("N/A mrays/sec", EditorStyles.miniLabel, new GUILayoutOption[0]);
            }
            GUILayout.EndVertical();
        }
Exemple #2
0
        void LightmapPerformanceStats(int index)
        {
            GUILayout.BeginVertical();

            GUILayout.Label("Index: " + index, EditorStyles.miniLabel);

            LightmapConvergence lc = Lightmapping.GetLightmapConvergence(index);

            if (lc.IsValid())
            {
                GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString((ulong)lc.occupiedTexelCount), EditorStyles.miniLabel);

                GUIContent direct = EditorGUIUtility.TrTextContent("Direct: " + lc.minDirectSamples + " / " + lc.maxDirectSamples + " / " + lc.avgDirectSamples + "", "min / max / avg samples per texel");
                GUILayout.Label(direct, EditorStyles.miniLabel);

                GUIContent gi = EditorGUIUtility.TrTextContent("GI: " + lc.minGISamples + " / " + lc.maxGISamples + " / " + lc.avgGISamples + "", "min / max / avg samples per texel");
                GUILayout.Label(gi, EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("Occupied: N/A", EditorStyles.miniLabel);
                GUILayout.Label("Direct: N/A", EditorStyles.miniLabel);
                GUILayout.Label("GI: N/A", EditorStyles.miniLabel);
            }
            float mraysPerSec = Lightmapping.GetLightmapBakePerformance(index);

            if (mraysPerSec >= 0.0)
            {
                GUILayout.Label(mraysPerSec.ToString("0.00") + " mrays/sec", EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("N/A mrays/sec", EditorStyles.miniLabel);
            }

            GUILayout.EndVertical();
        }
Exemple #3
0
        private void LightmapDebugInfo(int index)
        {
            if (!showDebugInfo)
            {
                return;
            }

            GUILayout.Space(5);
            GUILayout.BeginVertical();

            LightmapConvergence lc = Lightmapping.GetLightmapConvergence(index);

            if (lc.IsValid())
            {
                GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString((ulong)lc.occupiedTexelCount), EditorStyles.miniLabel);

                GUIContent direct = EditorGUIUtility.TrTextContent("Direct: " + lc.minDirectSamples + " / " + lc.maxDirectSamples + " / " + lc.avgDirectSamples + "", "min / max / avg samples per texel");
                GUILayout.Label(direct, EditorStyles.miniLabel);

                GUIContent gi = EditorGUIUtility.TrTextContent("GI: " + lc.minGISamples + " / " + lc.maxGISamples + " / " + lc.avgGISamples + "", "min / max / avg samples per texel");
                GUILayout.Label(gi, EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("Occupied: N/A", EditorStyles.miniLabel);
                GUILayout.Label("Direct: N/A", EditorStyles.miniLabel);
                GUILayout.Label("GI: N/A", EditorStyles.miniLabel);
            }
            float mraysPerSec = Lightmapping.GetLightmapBakePerformance(index);

            if (mraysPerSec >= 0.0)
            {
                GUILayout.Label(mraysPerSec.ToString("0.00") + " mrays/sec", EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("N/A mrays/sec", EditorStyles.miniLabel);
            }

            LightmapMemory lightmapMemory = Lightmapping.GetLightmapMemory(index);

            GUILayout.Label("Lightmap data: " + SizeString(lightmapMemory.lightmapDataSizeCPU), EditorStyles.miniLabel);

            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.BeginVertical();

            GUIContent lightmapTexturesSizeContent = null;

            if (lightmapMemory.lightmapTexturesSize > 0.0f)
            {
                lightmapTexturesSizeContent = EditorGUIUtility.TrTextContent("Lightmap textures: " + SizeString(lightmapMemory.lightmapTexturesSize));
            }
            else
            {
                lightmapTexturesSizeContent = EditorGUIUtility.TrTextContent("Lightmap textures: N/A", "This lightmap has converged and is not owned by the Progressive Lightmapper anymore.");
            }
            GUILayout.Label(lightmapTexturesSizeContent, EditorStyles.miniLabel);

            GUIContent GPUSizeContent = null;

            if (lightmapMemory.lightmapDataSizeGPU > 0.0f)
            {
                GPUSizeContent = EditorGUIUtility.TrTextContent("GPU memory: " + SizeString(lightmapMemory.lightmapDataSizeGPU));
            }
            else
            {
                GPUSizeContent = EditorGUIUtility.TrTextContent("GPU memory: N/A");
            }
            GUILayout.Label(GPUSizeContent, EditorStyles.miniLabel);

            GUILayout.EndVertical();
        }
Exemple #4
0
        private void LightmapDebugInfo(int index)
        {
            if (!showDebugInfo)
            {
                return;
            }

            GUILayout.Space(5);
            GUILayout.BeginVertical();

            LightmapConvergence lc = Lightmapping.GetLightmapConvergence(index);

            if (lc.IsValid())
            {
                ulong occupiedTexels = (ulong)lc.occupiedTexelCount;
                if (lc.tilingMode > 0)
                {
                    // Make sure we display the total amount of occupied texels once lightmap is converged
                    // If tiling is on, and lightmap is not converged, display the occupied texel count in current tile
                    if (lc.IsConverged())
                    {
                        GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString(occupiedTexels), EditorStyles.miniLabel);
                        GUILayout.Label("Baked using " + lc.GetTileCount() + " tiles", EditorStyles.miniLabel);
                    }
                    else
                    {
                        occupiedTexels = (ulong)lc.occupiedTexelCountInCurrentTile;
                        GUILayout.Label("Occupied (in tile): " + InternalEditorUtility.CountToString(occupiedTexels), EditorStyles.miniLabel);
                        GUILayout.Label("Baking pass (#tile): " + (lc.tilingPassNum + 1) + "/" + lc.GetTileCount(), EditorStyles.miniLabel);
                    }
                }
                else
                {
                    GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString(occupiedTexels), EditorStyles.miniLabel);
                }
                GUIContent direct = EditorGUIUtility.TrTextContent("Direct: " + lc.minDirectSamples + " / " + lc.maxDirectSamples + " / " + lc.avgDirectSamples + "", "min / max / avg samples per texel");
                GUILayout.Label(direct, EditorStyles.miniLabel);

                GUIContent gi = EditorGUIUtility.TrTextContent("GI: " + lc.minGISamples + " / " + lc.maxGISamples + " / " + lc.avgGISamples + "", "min / max / avg samples per texel");
                GUILayout.Label(gi, EditorStyles.miniLabel);

                GUIContent env = EditorGUIUtility.TrTextContent("Environment: " + lc.minEnvSamples + " / " + lc.maxEnvSamples + " / " + lc.avgEnvSamples + "", "min / max / avg samples per texel");
                GUILayout.Label(env, EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("Occupied: N/A", EditorStyles.miniLabel);
                GUILayout.Label("Direct: N/A", EditorStyles.miniLabel);
                GUILayout.Label("GI: N/A", EditorStyles.miniLabel);
                GUILayout.Label("Environment: N/A", EditorStyles.miniLabel);
            }
            float mraysPerSec = Lightmapping.GetLightmapBakePerformance(index);

            if (mraysPerSec >= 0.0)
            {
                GUILayout.Label(mraysPerSec.ToString("0.00", CultureInfo.InvariantCulture.NumberFormat) + " mrays/sec", EditorStyles.miniLabel);
            }
            else
            {
                GUILayout.Label("N/A mrays/sec", EditorStyles.miniLabel);
            }

            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.BeginVertical();

            LightmapMemory lightmapMemory = Lightmapping.GetLightmapMemory(index);

            GUILayout.Label("Lightmap data: " + SizeString(lightmapMemory.lightmapDataSizeCPU), EditorStyles.miniLabel);

            GUIContent lightmapTexturesSizeContent = null;

            if (lightmapMemory.lightmapTexturesSize > 0.0f)
            {
                lightmapTexturesSizeContent = EditorGUIUtility.TrTextContent("Lightmap textures: " + SizeString(lightmapMemory.lightmapTexturesSize));
            }
            else
            {
                lightmapTexturesSizeContent = EditorGUIUtility.TrTextContent("Lightmap textures: N/A", "This lightmap has converged and is not owned by the Progressive Lightmapper anymore.");
            }
            GUILayout.Label(lightmapTexturesSizeContent, EditorStyles.miniLabel);

            GUIContent GPUSizeContent = null;

            if (lightmapMemory.lightmapDataSizeGPU > 0.0f)
            {
                GPUSizeContent = EditorGUIUtility.TrTextContent("GPU memory: " + SizeString(lightmapMemory.lightmapDataSizeGPU));
            }
            else
            {
                GPUSizeContent = EditorGUIUtility.TrTextContent("GPU memory: N/A");
            }
            GUILayout.Label(GPUSizeContent, EditorStyles.miniLabel);

            GUILayout.EndVertical();
        }
 public void Maps()
 {
     if (LightingWindowLightmapPreviewTab.s_Styles == null)
     {
         LightingWindowLightmapPreviewTab.s_Styles = new LightingWindowLightmapPreviewTab.Styles();
     }
     GUI.changed = false;
     if (Lightmapping.giWorkflowMode == Lightmapping.GIWorkflowMode.OnDemand)
     {
         SerializedObject   serializedObject = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
         SerializedProperty property         = serializedObject.FindProperty("m_LightingDataAsset");
         EditorGUILayout.PropertyField(property, LightingWindowLightmapPreviewTab.s_Styles.LightingDataAsset, new GUILayoutOption[0]);
         serializedObject.ApplyModifiedProperties();
     }
     GUILayout.Space(10f);
     LightmapData[] lightmaps = LightmapSettings.lightmaps;
     this.m_ScrollPositionMaps = GUILayout.BeginScrollView(this.m_ScrollPositionMaps, new GUILayoutOption[0]);
     using (new EditorGUI.DisabledScope(true))
     {
         bool           flag  = false;
         bool           flag2 = false;
         LightmapData[] array = lightmaps;
         for (int i = 0; i < array.Length; i++)
         {
             LightmapData lightmapData = array[i];
             if (lightmapData.lightmapDir != null)
             {
                 flag = true;
             }
             if (lightmapData.shadowMask != null)
             {
                 flag2 = true;
             }
         }
         for (int j = 0; j < lightmaps.Length; j++)
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUILayout.Space(5f);
             lightmaps[j].lightmapColor = this.LightmapField(lightmaps[j].lightmapColor, j);
             if (flag)
             {
                 GUILayout.Space(10f);
                 lightmaps[j].lightmapDir = this.LightmapField(lightmaps[j].lightmapDir, j);
             }
             if (flag2)
             {
                 GUILayout.Space(10f);
                 lightmaps[j].shadowMask = this.LightmapField(lightmaps[j].shadowMask, j);
             }
             GUILayout.Space(5f);
             LightmapConvergence lightmapConvergence = Lightmapping.GetLightmapConvergence(j);
             GUILayout.BeginVertical(new GUILayoutOption[0]);
             GUILayout.Label("Index: " + j, EditorStyles.miniBoldLabel, new GUILayoutOption[0]);
             if (lightmapConvergence.IsValid())
             {
                 GUILayout.Label("Occupied: " + InternalEditorUtility.CountToString((ulong)((long)lightmapConvergence.occupiedTexelCount)), EditorStyles.miniLabel, new GUILayoutOption[0]);
                 GUIContent content = EditorGUIUtility.TextContent(string.Concat(new object[]
                 {
                     "Direct: ",
                     lightmapConvergence.minDirectSamples,
                     " / ",
                     lightmapConvergence.maxDirectSamples,
                     " / ",
                     lightmapConvergence.avgDirectSamples,
                     "|min / max / avg samples per texel"
                 }));
                 GUILayout.Label(content, EditorStyles.miniLabel, new GUILayoutOption[0]);
                 GUIContent content2 = EditorGUIUtility.TextContent(string.Concat(new object[]
                 {
                     "GI: ",
                     lightmapConvergence.minGISamples,
                     " / ",
                     lightmapConvergence.maxGISamples,
                     " / ",
                     lightmapConvergence.avgGISamples,
                     "|min / max / avg samples per texel"
                 }));
                 GUILayout.Label(content2, EditorStyles.miniLabel, new GUILayoutOption[0]);
             }
             else
             {
                 GUILayout.Label("Occupied: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]);
                 GUILayout.Label("Direct: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]);
                 GUILayout.Label("GI: N/A", EditorStyles.miniLabel, new GUILayoutOption[0]);
             }
             float lightmapBakePerformance = Lightmapping.GetLightmapBakePerformance(j);
             if ((double)lightmapBakePerformance >= 0.0)
             {
                 GUILayout.Label(lightmapBakePerformance.ToString("0.00") + " mrays/sec", EditorStyles.miniLabel, new GUILayoutOption[0]);
             }
             else
             {
                 GUILayout.Label("N/A mrays/sec", EditorStyles.miniLabel, new GUILayoutOption[0]);
             }
             GUILayout.EndVertical();
             GUILayout.FlexibleSpace();
             GUILayout.EndHorizontal();
         }
     }
     GUILayout.EndScrollView();
 }