Beispiel #1
0
        public virtual void DrawRegisteredPrefabsBoxList()
        {
            if (Application.isPlaying && _manager.runtimeDataList != null && _manager.runtimeDataList.Count > 0)
            {
                int totalInsanceCount   = 0;
                int totalDrawCallCount  = 0;
                int totalShadowDrawCall = 0;
                foreach (GPUInstancerRuntimeData runtimeData in _manager.runtimeDataList)
                {
                    if (runtimeData == null)
                    {
                        continue;
                    }

                    int drawCallCount       = 0;
                    int shadowDrawCallCount = 0;
                    if (runtimeData.transformationMatrixVisibilityBuffer != null && runtimeData.instanceLODs != null && runtimeData.bufferSize > 0 && runtimeData.instanceCount > 0)
                    {
                        for (int i = 0; i < runtimeData.instanceLODs.Count; i++)
                        {
                            for (int j = 0; j < runtimeData.instanceLODs[i].renderers.Count; j++)
                            {
                                GPUInstancerRenderer gpuiRenderer = runtimeData.instanceLODs[i].renderers[j];
                                if (!GPUInstancerUtility.IsInLayer(prop_layerMask.intValue, gpuiRenderer.layer))
                                {
                                    continue;
                                }
                                drawCallCount += gpuiRenderer.materials.Count;
                                if (runtimeData.prototype.isShadowCasting && gpuiRenderer.castShadows)
                                {
                                    shadowDrawCallCount += gpuiRenderer.materials.Count * QualitySettings.shadowCascades;
                                }
                            }
                        }
                    }
                    GUILayout.Label(runtimeData.prototype.ToString() + " Instance Count: " + runtimeData.instanceCount +
                                    "\n" + runtimeData.prototype.ToString() + " Geometry Draw Call Count: " + drawCallCount +
                                    (shadowDrawCallCount > 0 ? "\n" + runtimeData.prototype.ToString() + " Shadow Draw Call Count: " + shadowDrawCallCount : ""), GPUInstancerEditorConstants.Styles.label);

                    totalInsanceCount   += runtimeData.instanceCount;
                    totalDrawCallCount  += drawCallCount;
                    totalShadowDrawCall += shadowDrawCallCount;
                }

                GUILayout.Label("\nTotal Instance Count: " + totalInsanceCount +
                                "\n\n" + "Total Geometry Draw Call Count: " + totalDrawCallCount +
                                "\n" + "Total Shadow Draw Call Count: " + totalShadowDrawCall + " (" + QualitySettings.shadowCascades + " Cascades)" +
                                "\n\n" + "Total Draw Call Count: " + (totalDrawCallCount + totalShadowDrawCall)
                                , GPUInstancerEditorConstants.Styles.boldLabel);
            }
            else
            {
                GPUInstancerEditorConstants.DrawCustomLabel("No registered prefabs.", GPUInstancerEditorConstants.Styles.label, false);
            }
        }