Esempio n. 1
0
        static public void OnGUI()
        {
            if (timer == null)
            {
                LightingDebug.timer = TimerHelper.Create();
            }
            if (timer.GetMillisecs() > 1000)
            {
                ShowLightBufferUpdates = LightBufferUpdates;

                LightBufferUpdates = 0;

                ShowLightMainBufferUpdates = LightMainBufferUpdates;

                LightMainBufferUpdates = 0;

                ShowLightMainCameraUpdates = LightMainCameraUpdates;

                LightMainCameraUpdates = 0;

                timer = TimerHelper.Create();
            }

            if (SpriteRenderersDrawn > 0)
            {
                ShowSpriteRenderersDrawn = SpriteRenderersDrawn;
                SpriteRenderersDrawn     = 0;
            }


            int count = 0;

            foreach (LightingSource2D light in LightingSource2D.GetList())
            {
                if (light.InCamera() == false)
                {
                    continue;
                }
                count++;
            }

            GUI.Label(new Rect(10, 10, 500, 20), "Lights in Camera: " + count + "/" + LightingSource2D.GetList().Count);
            GUI.Label(new Rect(10, 30, 500, 20), "Free Buffers: " + FBOManager.GetFreeCount() + "/" + FBOManager.GetList().Count);
            GUI.Label(new Rect(10, 50, 500, 20), "Light Buffer Updates: " + ShowLightBufferUpdates);
            GUI.Label(new Rect(10, 70, 500, 20), "Total Light Updates: " + totalLightUpdates);
            GUI.Label(new Rect(10, 90, 500, 20), "=========================");

            GUI.Label(new Rect(10, 110, 500, 20), "Mask Generations: " + maskGenerations);
            GUI.Label(new Rect(10, 130, 500, 20), "Shadow Generations: " + shadowGenerations);
            GUI.Label(new Rect(10, 150, 500, 20), "Penumbra Generations: " + penumbraGenerations);
            GUI.Label(new Rect(10, 170, 500, 20), "Objects Culled: " + culled);

            GUI.Label(new Rect(10, 190, 500, 20), "=========================");

            GUI.Label(new Rect(10, 210, 500, 20), "Sprite Renderers Drawn: " + ShowSpriteRenderersDrawn);

            GUI.Label(new Rect(10, 230, 500, 20), "=========================");

            GUI.Label(new Rect(10, 250, 500, 20), "Light Main Buffer Updates: " + ShowLightMainBufferUpdates);
            GUI.Label(new Rect(10, 270, 500, 20), "Light Main Camera Updates: " + ShowLightMainCameraUpdates);

            GUI.Label(new Rect(10, 290, 500, 20), "=========================");

            Texture texture = LightingMainBuffer2D.Get().bufferCamera.activeTexture;

            if (texture != null)
            {
                GUI.Label(new Rect(10, 310, 500, 20), "Main Buffer Resolution: " + texture.width + "x" + texture.height);
            }
            else
            {
                GUI.Label(new Rect(10, 330, 500, 20), "Main Buffer Resolution: NULL");
            }

            GUI.Label(new Rect(10, 350, 500, 20), "Glow Particles Generated: " + BlurManager.dictionary.Count);

            GUIStyle style = new GUIStyle();

            style.alignment        = TextAnchor.LowerRight;
            style.normal.textColor = Color.white;
            style.fontSize         = 13;

                        #if UNITY_2018_1_OR_NEWER
            Object[] tilemaps = Object.FindObjectsOfType(typeof(LightingTilemapCollider2D));
                        #endif
            Object[] lights    = Object.FindObjectsOfType(typeof(LightingSource2D));
            Object[] colliders = Object.FindObjectsOfType(typeof(LightingCollider2D));
            Object[] sprites   = Object.FindObjectsOfType(typeof(LightingSpriteRenderer2D));

                        #if UNITY_2018_1_OR_NEWER
            GUI.Label(new Rect(0, -10, Screen.width - 10, Screen.height), "Tilemap Collider Count: " + tilemaps.Length, style);
                        #endif

            GUI.Label(new Rect(0, -30, Screen.width - 10, Screen.height), "Lights Count: " + lights.Length, style);
            GUI.Label(new Rect(0, -50, Screen.width - 10, Screen.height), "Colliders Count: " + colliders.Length, style);
            GUI.Label(new Rect(0, -70, Screen.width - 10, Screen.height), "Sprites Count: " + sprites.Length, style);
        }
Esempio n. 2
0
    static public void OnGUI()
    {
        if (lights == null)
        {
            lights    = Object.FindObjectsOfType(typeof(LightingSource2D));
            colliders = Object.FindObjectsOfType(typeof(LightingCollider2D));
            sprites   = Object.FindObjectsOfType(typeof(LightingSpriteRenderer2D));
            tilemaps  = Object.FindObjectsOfType(typeof(LightingTilemapCollider2D));
        }

        if (timer == null)
        {
            LightingDebug.timer = TimerHelper.Create();
        }

        if (timer.GetMillisecs() > 1000)
        {
            SecondUpdate();
        }

        ShowUpdate();

        int count = 0;

        foreach (LightingSource2D light in LightingSource2D.GetList())
        {
            if (light.InCamera() == false)
            {
                continue;
            }
            count++;
        }

        LightingManager2D manager2D = LightingManager2D.Get();

        int y = 10;

        GUI.Label(new Rect(10, y, 500, 20), "Camera Size: " + manager2D.mainBuffer.cameraSize);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "New Render Textures: " + NewRenderTextures);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Lights in Camera: " + count + "/" + LightingSource2D.GetList().Count);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Free Buffers: " + FBOManager.GetFreeCount() + "/" + FBOManager.GetList().Count);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Light Buffer Updates: " + ShowLightBufferUpdates); // In Frame

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Total Light Updates: " + totalLightUpdates);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "=========================");

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Mask Generations: " + show_maskGenerations);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Shadow Generations: " + show_shadowGenerations);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Objects Culled: " + show_culled);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "=========================");

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Shadow Collider World Generations C: " + ShadowColliderTotalGenerationsWorld_collider + " (re: " + ShadowColliderTotalGenerationsWorld_collider_re + ") Pair: " + LightingDebug.ShadowColliderTotalGenerationsWorld_collider_pair);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Shadow Collider Local Generations C: " + ShadowColliderTotalGenerationsLocal_collider);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Shadow Collider World Generations S: " + ShadowColliderTotalGenerationsWorld_shape + " (re: " + ShadowColliderTotalGenerationsWorld_shape_re + ") Pair: " + LightingDebug.ShadowColliderTotalGenerationsWorld_shape_pair);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Shadow Collider Local Generations S: " + ShadowColliderTotalGenerationsLocal_shape);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Total Object SHAPE Generations: " + totalObjectMaskShapeGenerations);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Total Object MESH Generations : " + totalObjectMaskMeshGenerations);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "=========================");

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Convex Hull Generations: " + ShowConvexHullGenerations);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "=========================");

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Sprite Renderers Drawn: " + ShowSpriteRenderersDrawn);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "=========================");

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Light Main Buffer Updates: " + ShowLightMainBufferUpdates);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Light Main Camera Updates: " + ShowLightMainCameraUpdates);

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "=========================");

        y += 10;

        Texture texture = LightingMainBuffer2D.Get().bufferCamera.activeTexture;

        if (texture != null)
        {
            GUI.Label(new Rect(10, y, 500, 20), "Main Buffer Resolution: " + texture.width + "x" + texture.height);
        }
        else
        {
            GUI.Label(new Rect(10, y, 500, 20), "Main Buffer Resolution: NULL");
        }

        y += 10;

        GUI.Label(new Rect(10, y, 500, 20), "Glow Particles Generated: " + BlurManager.dictionary.Count);

        RightBottomPanel();
    }