Example #1
0
    public override void OnPreviewGUI(Rect rect, GUIStyle background)
    {
        NoesisView view = target as NoesisView;

        Noesis.ViewStats stats = view.GetStats();

        StringBuilder str = new StringBuilder();

        str.AppendLine("<b>FrameTime : </b>" + String.Format("{0:F2}", stats.FrameTime) + " ms");
        str.AppendLine("<b>UpdateTime: </b>" + String.Format("{0:F2}", stats.UpdateTime) + " ms");
        str.AppendLine("<b>RenderTime: </b>" + String.Format("{0:F2}", stats.RenderTime) + " ms");
        str.AppendLine();
        str.AppendLine("<b>Triangles: </b>" + stats.Triangles);
        str.AppendLine("<b>Draws: </b>" + stats.Draws);
        str.AppendLine("<b>Batches: </b>" + stats.Batches);
        str.AppendLine();
        str.AppendLine("<b>Tessellations: </b>" + stats.Tessellations);
        str.AppendLine("<b>Flushes: </b>" + stats.Flushes);
        str.AppendLine("<b>GeometrySize: </b>" + stats.GeometrySize);
        str.AppendLine();
        str.AppendLine("<b>Masks: </b>" + stats.Masks);
        str.AppendLine("<b>Opacities: </b>" + stats.Opacities);
        str.AppendLine("<b>RenderTargetSwitches: </b>" + stats.RenderTargetSwitches);
        str.AppendLine();
        str.AppendLine("<b>UploadedRamps: </b>" + stats.UploadedRamps);
        str.AppendLine("<b>RasterizedGlyphs: </b>" + stats.RasterizedGlyphs);
        str.AppendLine("<b>DiscardedGlyphTiles: </b>" + stats.DiscardedGlyphTiles);

        GUI.Label(rect, str.ToString(), previewLabelStyle);
    }
Example #2
0
    public override void OnPreviewGUI(Rect rect_, GUIStyle background)
    {
        NoesisView view = target as NoesisView;

        Noesis.ViewStats stats = view.GetStats();

        if (_previewStyle == null)
        {
            _previewStyle = new GUIStyle("PreOverlayLabel")
            {
                richText  = true,
                fontStyle = FontStyle.Normal
            };
        }

        StringBuilder header = new StringBuilder();

        header.AppendLine("<color=orange>" + view.Xaml.source + "</color>");

        _previewStyle.alignment = TextAnchor.UpperLeft;
        GUI.Label(new Rect(rect_.x + 5, rect_.y + 5, rect_.width, rect_.height), header.ToString(), _previewStyle);

        StringBuilder left = new StringBuilder();

        left.AppendLine("\n\nFrame Time (ms)");
        left.AppendLine("Update Time (ms)");
        left.AppendLine("Render Time (ms)");
        left.AppendLine();
        left.AppendLine("Triangles");
        left.AppendLine("Draws");
        left.AppendLine("Batches");
        left.AppendLine("Tessellations");
        left.AppendLine("Geometry Size (kB)");
        left.AppendLine("Flushes");
        left.AppendLine();
        left.AppendLine("Stencil Masks");
        left.AppendLine("Opacity Groups");
        left.AppendLine("RT Switches");
        left.AppendLine();
        left.AppendLine("Ramps Uploaded");
        left.AppendLine("Rasterized Glyphs");
        left.AppendLine("Discarded Glyph Tiles");

        _previewStyle.alignment = TextAnchor.UpperLeft;
        GUI.Label(new Rect(rect_.x + 15, rect_.y + 5, 220, 500), left.ToString(), _previewStyle);

        var format = new System.Globalization.NumberFormatInfo {
            NumberDecimalSeparator = "."
        };

        StringBuilder right = new StringBuilder();

        right.AppendLine("\n\n<b>" + stats.FrameTime.ToString("#,##0.00", format) + "</b>");
        right.AppendLine("<b>" + stats.UpdateTime.ToString("#,##0.00", format) + "</b>");
        right.AppendLine("<b>" + stats.RenderTime.ToString("#,##0.00", format) + "</b>");
        right.AppendLine();
        right.AppendLine("<b>" + stats.Triangles + "</b>");
        right.AppendLine("<b>" + stats.Draws + "</b>");
        right.AppendLine("<b>" + stats.Batches + "</b>");
        right.AppendLine("<b>" + stats.Tessellations + "</b>");
        right.AppendLine("<b>" + String.Format("{0:F0}", stats.GeometrySize / 1024) + "</b>");
        right.AppendLine("<b>" + stats.Flushes + "</b>");
        right.AppendLine();
        right.AppendLine("<b>" + stats.Masks + "</b>");
        right.AppendLine("<b>" + stats.Opacities + "</b>");
        right.AppendLine("<b>" + stats.RenderTargetSwitches + "</b>");
        right.AppendLine();
        right.AppendLine("<b>" + stats.UploadedRamps + "</b>");
        right.AppendLine("<b>" + stats.RasterizedGlyphs + "</b>");
        right.AppendLine("<b>" + stats.DiscardedGlyphTiles + "</b>");

        _previewStyle.alignment = TextAnchor.UpperRight;
        GUI.Label(new Rect(rect_.x + 15, rect_.y + 5, 220, 500), right.ToString(), _previewStyle);
    }