Exemple #1
0
        public async Task Draw(Framebuffer target)
        {
            var now = Graphics.Stopwatch.Elapsed;

            RecentFrameTimes.Add(now - LastDraw);
            if (RecentFrameTimes.Sum(x => x.TotalSeconds) > 0.25)
            {
                FrameTime = RecentFrameTimes.Average(x => x.TotalMilliseconds);
                RecentFrameTimes.Clear();
            }

            LastDraw = now;
            var fps = 1000 / FrameTime;

            TextViewLayer.Content =
                $"{now:hh\\:mm\\:ss}\n" +
                $"frame time {FrameTime:F1} ms ({(fps > 240 ? ">240" : $"{fps:F1}")} fps)\n" +
                $"camera focus {Spatial.CameraFocus}\n" +
                $"camera origin {Spatial.CameraFocus + Spatial.CameraEulerXyz.ToTransform() * new Vector3D(0, 0, 1, 0) * Spatial.CameraFocusDistance}\n" +
                $"camera rotation {Spatial.CameraEulerXyz}";
            await TextViewLayer.Draw(target);
        }
Exemple #2
0
 public void Dispose()
 {
     TextViewLayer.Dispose();
 }