feat: add affine rotation rendering and timeline diagnostics

This commit is contained in:
gamer147
2026-07-10 17:54:33 -04:00
parent 4d225618f9
commit 768863b48e
16 changed files with 686 additions and 150 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using Age.Engine.Diagnostics;
// Frontend-side trace consumer. Runs on the VM background thread, so it just queues the dispatched
@@ -7,10 +8,20 @@ using Age.Engine.Diagnostics;
// engine fact delivered over the trace seam.
public sealed class GodotTraceSink : ITraceSink
{
public bool TracingSteps => false;
private readonly GodotTimelineLog? _timeline;
private readonly Stack<string> _scripts = new();
public GodotTraceSink(GodotTimelineLog? timeline = null) => _timeline = timeline;
public bool TracingSteps => _timeline != null;
public readonly ConcurrentQueue<long> CallScripts = new();
public void Emit(in TraceEvent e)
{
if (e.Kind == TraceEventKind.CallScript) CallScripts.Enqueue(e.Id);
if (_timeline == null) return;
if (e.Kind == TraceEventKind.FrameEnter && e.Name != null) _scripts.Push(e.Name);
else if (e.Kind == TraceEventKind.FrameExit && _scripts.Count > 0) _scripts.Pop();
else if (e.Kind == TraceEventKind.Step && e.Ins != null)
_timeline.Step(_scripts.Count > 0 ? _scripts.Peek() : "<unknown>", e.Ins.Offset, e.Opcode, e.Depth);
else if (e.Kind == TraceEventKind.Halt)
_timeline.State("halted", new() { ["reason"] = e.Text, ["steps"] = e.Steps });
}
}