From a7d7746284d480f2bc926325b4a6e3617b643b75 Mon Sep 17 00:00:00 2001 From: Vorta <179685+Vorta@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:44:56 +0100 Subject: [PATCH] Improve AI network markers and directed link lanes --- CHANGELOG.md | 2 + src/zStudio.Rendering/SceneViewport.Ai.cs | 93 +++++++++++++++---- .../SceneViewport.Inspection.cs | 5 +- .../SceneViewport.Pickups.cs | 8 +- .../SceneInspectionMcpChecks.cs | 9 +- tools/zStudio.PreviewCheck/AiNetworkCheck.cs | 51 +++++++++- 6 files changed, 141 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d21b6442..60b1f566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Version numbers follow `MAJOR.MINOR.PATCH`; the 0.x series is under active devel ## 0.12.1 — Unreleased +- AI networks in RECOIL and MW3 use clickable circular node markers and directed triangles. + - zStudio is built on .NET 11 (included in `zStudio.exe`; nothing to install). ## 0.12.0 — 2026-11-08 diff --git a/src/zStudio.Rendering/SceneViewport.Ai.cs b/src/zStudio.Rendering/SceneViewport.Ai.cs index 205fb63e..d40e7a49 100644 --- a/src/zStudio.Rendering/SceneViewport.Ai.cs +++ b/src/zStudio.Rendering/SceneViewport.Ai.cs @@ -35,6 +35,13 @@ private sealed class AiOverlayGroup : GroupNode; /// The network a selection emphasises (the others are drawn faint), or null. public string? AiEmphasizedNetwork { get; private set; } public string? SelectedAiNode { get; private set; } + private IReadOnlyDictionary? valveRouteStates; + public void SetValveRouteStates(IReadOnlyDictionary? states) + { + if (states == null && valveRouteStates == null || states != null && valveRouteStates != null && states.Count == valveRouteStates.Count && + states.All(p => valveRouteStates.TryGetValue(p.Key, out bool value) && value == p.Value)) return; + valveRouteStates = states; RebuildAiOverlay(); + } public event Action? AiNodeSelected; public event Action? AiPropertiesRequested; public event Action? AiLabelChanged; @@ -43,6 +50,7 @@ public void SetAiNetworks(AiNetworkSnapshot snapshot) { if (AiNetworks.Id == snapshot.Id) return; SetAiPathEditing(null); + valveRouteStates = null; AiNetworks = snapshot; AiNetworkFilter = null; SelectedAiNode = null; hoveredAiNode = null; ValveFilter = null; RebuildAiOverlay(); } @@ -98,37 +106,60 @@ private void RebuildAiOverlay() if (nodes.Length < network.Nodes.Count) AiRenderTruncated = true; if (nodes.Length == 0) continue; RenderedAiNodes += nodes.Length; aiRendered.AddRange(nodes); - var markers = AiMesh(AiOctahedron(), color); - aiMarkers.Add((markers, nodes, strong ? 5 : 4)); + var markers = AiMesh(AiCircle(), color); + aiMarkers.Add((markers, nodes, strong ? 7 : 6)); var byId = nodes.ToDictionary(n => n.Id); - List<(AiNode Start, AiNode End)> edges = []; + List<(AiNode Start, AiNode End, int Slot)> edges = []; foreach (var node in nodes) - foreach (string target in node.PreviewLinks.Where(l => l.Target != null).Select(l => l.Target!).Distinct()) + foreach (var link in node.PreviewLinks.Where(l => l.Target != null)) { - if (!byId.TryGetValue(target, out var end)) { AiRenderTruncated = true; continue; } + if (!byId.TryGetValue(link.Target!, out var end)) { AiRenderTruncated = true; continue; } if (RenderedAiLinks == MaximumRenderedAiLinks) { AiRenderTruncated = true; break; } - edges.Add((node, end)); RenderedAiLinks++; + edges.Add((node, end, link.Slot)); RenderedAiLinks++; + } + var lines = AiMesh(BuildLinks(false), color); aiLinks.Add(lines, () => BuildLinks(false)); + if (valveRouteStates != null) + { + var blocked = AiMesh(BuildLinks(true), new(color.Red, color.Green, color.Blue, color.Alpha * .35f)); + aiLinks.Add(blocked, () => BuildLinks(true)); } - var lines = AiMesh(BuildLinks(), color); aiLinks.Add(lines, BuildLinks); - MeshData BuildLinks() + MeshData BuildLinks(bool blockedOnly) { List positions = []; List indices = []; var pose = CaptureView(); Vector3 forward = Vector3.Normalize(new((float)pose.LookDirection.X, (float)pose.LookDirection.Y, (float)pose.LookDirection.Z)); - foreach (var (startNode, endNode) in edges) + foreach (var (startNode, endNode, slot) in edges) { + bool blocked = valveRouteStates?.GetValueOrDefault(startNode.Id + "|" + slot, true) == false; + if (blocked != blockedOnly) continue; var start = AiPosition(startNode); var end = AiPosition(endNode); if ((end - start).LengthSquared() < 1e-8f) { - const int steps = 16; float radius = 3; + int occurrence = startNode.PreviewLinks.Count(l => l.Slot < slot && l.Target == endNode.Id); + const int steps = 24; float radius = AiScale(start, 12 + occurrence * 12); + var up = Vector3.Normalize(new((float)pose.UpDirection.X, (float)pose.UpDirection.Y, (float)pose.UpDirection.Z)); + var right = Vector3.Normalize(Vector3.Cross(forward, up)); up = Vector3.Cross(right, forward); + if (string.CompareOrdinal(startNode.Id, endNode.Id) > 0) right = -right; for (int i = 0; i < steps; i++) { - var a = start + new Vector3(radius + radius * MathF.Cos(MathF.PI + i * MathF.Tau / steps), 0, radius * MathF.Sin(MathF.PI + i * MathF.Tau / steps)); - var b = start + new Vector3(radius + radius * MathF.Cos(MathF.PI + (i + 1) * MathF.Tau / steps), 0, radius * MathF.Sin(MathF.PI + (i + 1) * MathF.Tau / steps)); - Segment(a, b); - if (i == 11) Arrow(a, b, 1.4f); + var a = start + right * (radius + radius * MathF.Cos(MathF.PI + i * MathF.Tau / steps)) + up * (radius * MathF.Sin(MathF.PI + i * MathF.Tau / steps)); + var b = start + right * (radius + radius * MathF.Cos(MathF.PI + (i + 1) * MathF.Tau / steps)) + up * (radius * MathF.Sin(MathF.PI + (i + 1) * MathF.Tau / steps)); + if (!blocked || i % 4 < 2) Segment(a, b); + if (i == 11) Arrow(a, b, AiScale(a, 9)); + } + } + else + { + // Reciprocal directions lie on opposite sides; each remains visible. + int occurrence = startNode.PreviewLinks.Count(l => l.Slot < slot && l.Target == endNode.Id); + var offset = Side(Vector3.Normalize(end - start)) * AiScale(Vector3.Lerp(start, end, .5f), 6 + occurrence * 12); + if (blocked) + { + for (int dash = 0; dash < 12; dash += 2) + Segment(Vector3.Lerp(start, end, dash / 12f) + offset, Vector3.Lerp(start, end, (dash + 1) / 12f) + offset); } + else Segment(start + offset, end + offset); + Arrow(start + offset, end + offset, (end - start).Length() * .18f); } - else { Segment(start, end); Arrow(start, end, (end - start).Length() * .18f); } } return new([.. positions], [.. indices], [.. positions.Select(_ => Vector3.UnitY)]); Vector3 Side(Vector3 direction) @@ -153,7 +184,7 @@ void Arrow(Vector3 from, Vector3 to, float size) } } BuildValveOverlay(); - aiSelectionMarker = AiMesh(AiOctahedron(), new(1, 1, 1, 1), twin: false); + aiSelectionMarker = AiMesh(AiCircle(), new(1, 1, 1, 1), twin: false); RefreshAiSelection(); UpdateAiMarkers(); view.InvalidateRender(); } /// How strongly the overlay shows through geometry that hides it. @@ -182,6 +213,28 @@ MeshNode Mesh(Color4 tint, bool through) [Vector3.UnitX, -Vector3.UnitX, Vector3.UnitY, -Vector3.UnitY, Vector3.UnitZ, -Vector3.UnitZ], [0, 2, 4, 4, 2, 1, 1, 2, 5, 5, 2, 0, 0, 4, 3, 4, 1, 3, 1, 5, 3, 5, 0, 3], [Vector3.UnitX, -Vector3.UnitX, Vector3.UnitY, -Vector3.UnitY, Vector3.UnitZ, -Vector3.UnitZ]); + private static MeshData AiCircle() + { + const int segments = 32; + List p = []; List indices = []; + for (int i = 0; i < segments; i++) + { + float a = i * MathF.Tau / segments, b = (i + 1) * MathF.Tau / segments; + var x = new Vector3(MathF.Cos(a), MathF.Sin(a), 0); var y = new Vector3(MathF.Cos(b), MathF.Sin(b), 0); + int n = p.Count; p.AddRange([x, y, y * .65f, x * .65f]); + indices.AddRange([n, n + 1, n + 2, n, n + 2, n + 3]); + } + return new([.. p], [.. indices], [.. p.Select(_ => Vector3.UnitZ)]); + } + private Matrix4x4 AiMarkerTransform(Vector3 point, double radius) + { + var pose = CaptureView(); + var forward = Vector3.Normalize(new((float)pose.LookDirection.X, (float)pose.LookDirection.Y, (float)pose.LookDirection.Z)); + var up = Vector3.Normalize(new((float)pose.UpDirection.X, (float)pose.UpDirection.Y, (float)pose.UpDirection.Z)); + var right = Vector3.Normalize(Vector3.Cross(forward, up)); up = Vector3.Cross(right, forward); + var basis = new Matrix4x4(right.X, right.Y, right.Z, 0, up.X, up.Y, up.Z, 0, -forward.X, -forward.Y, -forward.Z, 0, 0, 0, 0, 1); + return Matrix4x4.CreateScale(AiScale(point, radius)) * basis * Matrix4x4.CreateTranslation(point); + } private float AiScale(Vector3 point, double pixels) { var pose = CaptureView(); var forward = pose.LookDirection; forward.Normalize(); @@ -197,7 +250,7 @@ private void UpdateAiMarkers() aiMarkerPose = pose; aiMarkerWidth = viewport.ActualWidth; aiMarkerHeight = viewport.ActualHeight; foreach (var (mesh, nodes, pixels) in aiMarkers) { - var instances = nodes.Select(n => Matrix4x4.CreateScale(AiScale(AiPosition(n), pixels)) * Matrix4x4.CreateTranslation(AiPosition(n))).ToArray(); + var instances = nodes.Select(n => AiMarkerTransform(AiPosition(n), pixels)).ToArray(); mesh.Instances = instances; if (aiBehind.TryGetValue(mesh, out var behind)) behind.Instances = instances; } @@ -217,13 +270,13 @@ private void RefreshAiSelection() { aiSelectionMarker.Visibility = PlacementEditingEnabled && aiPathSelection.Count != 0 ? Visibility.Visible : Visibility.Collapsed; aiSelectionMarker.Instances = AiNetworks.Networks.Single(n => n.Id == network).Nodes.Where(n => aiPathSelection.Contains(n.Id)) - .Select(n => Matrix4x4.CreateScale(AiScale(AiPosition(n), 5.5)) * Matrix4x4.CreateTranslation(AiPosition(n))).ToArray(); + .Select(n => AiMarkerTransform(AiPosition(n), 8)).ToArray(); } else { var selected = SelectedAiNode == null ? null : AiNetworks.Find(SelectedAiNode); aiSelectionMarker.Visibility = selected == null ? Visibility.Collapsed : Visibility.Visible; - if (selected is { } target) aiSelectionMarker.Instances = [Matrix4x4.CreateScale(AiScale(target.Node.Position, 5.5)) * Matrix4x4.CreateTranslation(target.Node.Position)]; + if (selected is { } target) aiSelectionMarker.Instances = [AiMarkerTransform(target.Node.Position, 8)]; } } PublishAiLabel(); view.InvalidateRender(); @@ -257,7 +310,7 @@ private bool TryProjectAiNode(AiNode node, out Point screen, out double depth) var position = AiPosition(node); var pose = CaptureView(); var forward = pose.LookDirection; forward.Normalize(); Point3D point = new(position.X, position.Y, position.Z); depth = Vector3D.DotProduct(point - pose.Position, forward); - if (!double.IsFinite(depth) || depth <= 0) return false; + if (!double.IsFinite(depth) || pose.Projection != "orthographic" && depth <= 0) return false; screen = view.Project(point); if (!double.IsFinite(screen.X) || !double.IsFinite(screen.Y) || !IsInsidePickupViewport(screen)) return false; return AiThroughGeometry || view.Camera is not RenderCamera camera || depth >= camera.NearPlaneDistance && depth <= camera.FarPlaneDistance; diff --git a/src/zStudio.Rendering/SceneViewport.Inspection.cs b/src/zStudio.Rendering/SceneViewport.Inspection.cs index 93f8368a..a1c69545 100644 --- a/src/zStudio.Rendering/SceneViewport.Inspection.cs +++ b/src/zStudio.Rendering/SceneViewport.Inspection.cs @@ -92,7 +92,7 @@ private void RegisterInspectionMesh(MeshNode mesh, int material, long? runtime = } private SceneInspection? InspectAi(string id) { - if (!AiVisible || AiNetworks.Find(id) is not { } item || AiNetworkFilter != null && item.Network.Id != AiNetworkFilter) return null; + if (!AiVisible || AiNetworks.Find(id) is not { } item || AiNetworkFilter != null && item.Network.Id != AiNetworkFilter || aiHiddenNetworks.Contains(item.Network.Id)) return null; return new("ai:" + AiNetworks.Id + ":" + id, -1, -1, -1, null, id, null, null, item.Node.Position, true, null); } private SceneInspection? InspectHit(RenderHit hit) @@ -144,10 +144,11 @@ public bool SelectInspection(string? target, bool guard = true, int? exactNode = { var next = target == null ? null : InspectTarget(target); if (target != null && next == null || IsFlyActive || IsPickupDragging || guard && CanChangeInspection?.Invoke() == false) return false; + // AI admission can also refuse path-edit mode or a pending draft. Publish only after it succeeds. + if (next?.AiNode is { } ai) return SelectAiNode(ai); if (next != null && exactNode is int exact) next = next with { OwnerNode = exact, ExactSelection = true }; SelectedInspection = next; if (next == null) { SelectAiNode(null); SelectPickup(null); FramingSelection = null; InspectionSelectionCleared?.Invoke(); } - else if (next.AiNode is { } ai) SelectAiNode(ai); else if (next is { Node: >= 0 } node) { SelectFramingNode(PickupAt(node.SelectionNode)?.Root ?? node.SelectionNode); NodeSelected?.Invoke(node.SelectionNode); } RefreshPickupSelection(); InspectionChanged?.Invoke(); return true; } diff --git a/src/zStudio.Rendering/SceneViewport.Pickups.cs b/src/zStudio.Rendering/SceneViewport.Pickups.cs index f712cebf..4ba257fe 100644 --- a/src/zStudio.Rendering/SceneViewport.Pickups.cs +++ b/src/zStudio.Rendering/SceneViewport.Pickups.cs @@ -196,6 +196,12 @@ private ScenePlacement AdjustPickupPlacement(ScenePlacement p) private void RefreshPickupSelection() { if (selectionBox == null || pickupManipulator == null || pickupTarget == null) return; + // AI nodes own a camera-facing selection ring; a world-space box hides its rim. + if (SelectedInspection?.AiNode != null) + { + selectionBox.Visibility = pickupManipulator.Visibility = Visibility.Collapsed; + pickupManipulator.Target = null; SetPickupHover(false); return; + } bool selected = worldInspection && SelectedInspection is { Active: true }; selectionBox.Visibility = selected ? Visibility.Visible : Visibility.Collapsed; pickupManipulator.Visibility = CanManipulate ? Visibility.Visible : Visibility.Collapsed; @@ -216,8 +222,6 @@ private void RefreshPickupSelection() } var selectionFrame = SelectionBoundsFrame(selectedNodes); var inverseFrame = selectionFrame; inverseFrame.Invert(); - if (SelectedInspection?.AiNode is { } ai && AiNetworks.Find(ai) is { } node) - { float radius = AiScale(node.Node.Position, 5.5); min = node.Node.Position - new Vector3(radius); max = node.Node.Position + new Vector3(radius); } long selectedRuntimeOwner = (SelectedInspection?.RuntimeInstance ?? 0) >> 32; foreach (var (mesh, items) in visiblePlacements) { diff --git a/tests/zStudio.Desktop.Tests/SceneInspectionMcpChecks.cs b/tests/zStudio.Desktop.Tests/SceneInspectionMcpChecks.cs index 8955f3e0..71ee9eb5 100644 --- a/tests/zStudio.Desktop.Tests/SceneInspectionMcpChecks.cs +++ b/tests/zStudio.Desktop.Tests/SceneInspectionMcpChecks.cs @@ -96,7 +96,8 @@ internal static async Task Run() await Call("ai_selection", new() { ["preview"] = preview, ["snapshot"] = graph.Id, ["action"] = "select", ["node"] = aiId }); Assert.Equal(aiId, viewport.SelectedAiNode); Assert.NotNull(viewport.SelectedInspection); await Card("select", new() { ["target"] = target }); - Assert.True(viewport.SelectionBoundsVisible); Assert.False(viewport.TransformHandlesVisible); + // AI selection uses the circular marker (verified by presented pixels in AiNetworkCheck), not a world box. + Assert.False(viewport.SelectionBoundsVisible); Assert.False(viewport.TransformHandlesVisible); var inspectionCard = (SceneInspectionCard)viewport.InspectionContent!; inspectionCard.Measure(new(800, 600)); inspectionCard.Arrange(new Rect(0, 0, 800, 600)); inspectionCard.UpdateLayout(); var panel = (Border)typeof(SceneInspectionCard).GetField("panel", BindingFlags.Instance | BindingFlags.NonPublic)!.GetValue(inspectionCard)!; @@ -150,6 +151,12 @@ internal static async Task Run() Assert.DoesNotContain(strategyReadout, Fields(inspectionCard)); Assert.Null((await Call("scene_inspect", new() { ["preview"] = preview }))["attackStrategy"]); Assert.True(viewport.SelectionBoundsVisible); Assert.False(viewport.TransformHandlesVisible); + // A retained target must not resurrect a hidden AI card or replace the current pickup selection. + var beforeHiddenTarget = viewport.SelectedInspection; + viewport.SetAiNetworkPresentation(new HashSet { graph.Networks[0].Id }, null); + await Card("select", new() { ["target"] = target }, "stale_record"); + Assert.Same(beforeHiddenTarget, viewport.SelectedInspection); Assert.Null(viewport.SelectedAiNode); + viewport.SetAiNetworkPresentation(new HashSet(), null); var box = viewport.SelectionBox!; AssertSelectionBox(ownerTransform, new(-2, 0, 0), new(9, 3, 0)); // The same two parts can belong to a reconstructed synthetic owner. diff --git a/tools/zStudio.PreviewCheck/AiNetworkCheck.cs b/tools/zStudio.PreviewCheck/AiNetworkCheck.cs index 4fd43568..d45e28ec 100644 --- a/tools/zStudio.PreviewCheck/AiNetworkCheck.cs +++ b/tools/zStudio.PreviewCheck/AiNetworkCheck.cs @@ -136,6 +136,35 @@ private static async Task Synthetic(string output) await Shown(scene, () => scene.SetAiOptions(false, false, null)); Require(original.SequenceEqual(Pixels(scene.CapturePresentedFrame())), "Disabling AI did not restore the scene"); scene.SetPlacementEditing(true); + // Presented pixels distinguish hollow camera-facing circles from the former filled marker. + foreach (var wall in walls) wall.IsTransparent = true; + await Shown(scene, () => scene.SetAiOptions(false, true, null)); + var noMarkers = Pixels(scene.CapturePresentedFrame()); + await Shown(scene, () => scene.SetAiOptions(true, true, null)); + var circles = scene.CapturePresentedFrame(); var circlePixels = Pixels(circles); + Require(!Changed(point, 1, noMarkers, circlePixels) && Changed(point, 7, noMarkers, circlePixels), "Node marker must have a hollow center and visible circular rim"); + Save(circles, Path.Combine(output, "fixture-circles.png")); + var coincident = new AiNetwork("coincident", "fixture", 0, "net_01.zrd", "coincident", "standard", 10, + [a with { Links = [new(0, 1, "b", null), new(1, 1, "b", null)] }, b with { Position = a.Position }], []); + scene.SetAiNetworks(new("coincident", [coincident])); + await Shown(scene, () => scene.SetValveRouteStates(new Dictionary { ["a|1"] = false })); + var loops = scene.CapturePresentedFrame(); + Require(HasColor(loops, scene, new(point.X + 24, point.Y), "#FF6666") && HasColor(loops, scene, new(point.X - 24, point.Y), "#FF6666"), "Coincident directed links lost their reciprocal loop representation"); + Save(loops, Path.Combine(output, "fixture-coincident-blocked.png")); + await Shown(scene, () => scene.SetValveRouteStates(null)); + Require(!Pixels(loops).SequenceEqual(Pixels(scene.CapturePresentedFrame())), "Duplicate blocked outgoing slot did not have a separate visible lane"); + scene.SetAiNetworks(new("behind-eye", [coincident with { Nodes = [a with { Position = new(0, 4, 22), Links = [] }] }])); + scene.SetAiOptions(false, true, null); + await Shown(scene, () => scene.RestoreView(pose with { Projection = "orthographic", OrthographicWidth = 40 })); + var beforeBehind = Pixels(scene.CapturePresentedFrame()); + await Shown(scene, () => scene.SetAiOptions(true, true, null)); + var behind = scene.ProjectToView(new Point3D(0, 4, 22)); + Require(Changed(behind, 7, beforeBehind, Pixels(scene.CapturePresentedFrame())) && scene.PickAiNode(behind) == "a", "Visible orthographic behind-eye marker must remain clickable"); + await Shown(scene, () => scene.SetAiOptions(true, false, null)); + Require(scene.PickAiNode(behind) == null, "Depth-clipped orthographic marker remained clickable"); + scene.RestoreView(pose); + scene.SetAiNetworks(new("fixture-restored", [new("network", "fixture.zbd", 0, "net_01.zrd", "fixture", "standard", 10, [a, b], [])])); + await Shown(scene, () => scene.SetAiOptions(true, true, null)); (string Label, AiAttackStrategy Strategy, string Hex)[] strategyCases = [ ("head", AiAttackStrategy.Stored("Head-on"), "#FFA640"), ("circle", AiAttackStrategy.Stored("cIrClE"), "#33D9FF"), @@ -156,13 +185,17 @@ private static async Task Synthetic(string output) await Shown(scene, () => scene.SetAiOptions(true, through, null)); var rendered = scene.CapturePresentedFrame(); Require(HasColor(rendered, scene, point, hex), "Wrong marker color: " + text); - Require(HasColor(rendered, scene, scene.ProjectToView(new Point3D(0, 0, -2)), hex), "Wrong arrow/connection color: " + text); + var middle = scene.ProjectToView(new Point3D(0, 0, -2)); + Require(HasColor(rendered, scene, new(middle.X, middle.Y - 6), hex), "Wrong arrow/connection color: " + text); Require(HasColor(rendered, scene, scene.ProjectToView(new Point3D(-6, 5, -2)), hex), "Same strategy differs between networks: " + text); await Shown(scene, () => scene.SetAiOptions(true, through, "network")); Require(HasColor(scene.CapturePresentedFrame(), scene, point, hex), "Filtering changed strategy color: " + text); } + var beforeSelection = Pixels(scene.CapturePresentedFrame()); bool picked = false; await Shown(scene, () => picked = scene.SelectAiNode("a")); Require(picked, "Strategy marker selection failed"); - Require(HasColor(scene.CapturePresentedFrame(), scene, point, "#FFFFFF"), "Selected marker lost white highlight"); + Save(scene.CapturePresentedFrame(), Path.Combine(output, "selected-" + text + ".png")); + Require(Changed(point, 8, beforeSelection, Pixels(scene.CapturePresentedFrame())) && + HasColor(scene.CapturePresentedFrame(), scene, new(point.X + 6.5, point.Y), "#FFFFFF"), "Selected marker lost white highlight"); bool cleared = false; await Shown(scene, () => cleared = scene.SelectAiNode(null)); Require(cleared, "Strategy marker clearing failed"); Require(HasColor(scene.CapturePresentedFrame(), scene, point, hex), "Clearing selection did not restore strategy color: " + text); Save(scene.CapturePresentedFrame(), Path.Combine(output, "strategy-" + text + ".png")); @@ -206,6 +239,20 @@ private static async Task Synthetic(string output) Console.WriteLine("PASS: valve cages retain strategy colors, assignments/highlights render, filtering restores base pixels, idle/depth/camera stable and associations frame"); Console.WriteLine("PASS: rendered strategy colors for markers/arrows, equal strategies across networks, filtering, both depth modes and white selection"); Console.WriteLine("PASS: GPU through/occluded modes, reciprocal arrows, visibility-aware picking, unchanged clipping/camera and idle back buffer"); + Console.WriteLine("PASS: hollow node circles, coincident reciprocal links, independent blocked duplicate slot and orthographic behind-eye picking"); + bool Changed(Point center, double radius, byte[] before, byte[] after) + { + int cx = (int)Math.Round(center.X * circles.PixelWidth / scene.RenderSurface.ActualWidth); + int cy = (int)Math.Round(center.Y * circles.PixelHeight / scene.RenderSurface.ActualHeight); + int r = (int)Math.Ceiling(radius * circles.PixelWidth / scene.RenderSurface.ActualWidth); + for (int y = Math.Max(0, cy - r); y <= Math.Min(circles.PixelHeight - 1, cy + r); y++) + for (int x = Math.Max(0, cx - r); x <= Math.Min(circles.PixelWidth - 1, cx + r); x++) + { + int at = (y * circles.PixelWidth + x) * 4; + if (!before.AsSpan(at, 4).SequenceEqual(after.AsSpan(at, 4))) return true; + } + return false; + } } finally { window.Close(); } }