fix(selection): port SmartBox click lighting pulse

Port the retail high/low material-lighting cadence for successful world clicks, keep it instance-scoped in the modern renderer, and restore authored lighting after 0.8 seconds. Correct the selection oracle and pin timing plus per-frame buffer lifecycle with tests.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-17 23:00:04 +02:00
parent 146a963aeb
commit ea4f52ec51
11 changed files with 338 additions and 16 deletions

View file

@ -7,8 +7,8 @@ namespace AcDream.App.Tests.Rendering.Wb;
public class InstanceGroupClearTests
{
// #193 (regression from #188, 2026-07-09): WbDrawDispatcher's InstanceGroup holds
// five per-instance parallel lists — Matrices, Slots, LightSets, IndoorFlags,
// Opacities — appended in lockstep (one entry per drawn instance) every frame. The
// six per-instance parallel lists — Matrices, Slots, LightSets, IndoorFlags,
// Opacities, SelectionLighting — appended in lockstep (one entry per drawn instance) every frame. The
// per-frame reset must clear ALL of them. #188 added Opacities but left it out of
// the inline clear loop, so it grew one float per instance per frame forever; as
// List<float>'s backing array doubled it produced ~128 MB / ~512 MB LOH float[]
@ -23,6 +23,7 @@ public class InstanceGroupClearTests
grp.LightSets.Add(-1);
grp.IndoorFlags.Add(0u);
grp.Opacities.Add(1.0f);
grp.SelectionLighting.Add(new Vector2(0f, 1f));
grp.ClearPerInstanceData();
@ -31,5 +32,6 @@ public class InstanceGroupClearTests
Assert.Empty(grp.LightSets);
Assert.Empty(grp.IndoorFlags);
Assert.Empty(grp.Opacities); // #193 — the list that leaked
Assert.Empty(grp.SelectionLighting);
}
}