Ejemplo n.º 1
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();
        }