feat(p10-reframe-w2): CPU wax-blob lava physics + 2D collision; smin metaball render

This commit is contained in:
daniel-c-harvey
2026-06-16 12:19:30 -04:00
parent ed7304af1f
commit db7afe4ea7
3 changed files with 680 additions and 488 deletions
@@ -58,7 +58,10 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
// datum-fetch / subscription / playback-coupling seams log to the browser console (prefixed
// `[MixVisualizer]`, same as the JS logs so the two interleave into one timeline). These pinpoint
// which upstream link is broken when the ribbon stays blank — set false once confirmed healthy.
private static readonly bool Debug = false;
// ON for the Phase 10 reframe Wave R2 lava test (matches the JS-side DEBUG in
// MixVisualizer.ts). Daniel evaluates the physics in-browser; flip back to false at
// reframe close along with the JS flag.
private static readonly bool Debug = true;
private const string Tag = "[MixVisualizer]";
private static void DebugLog(string message)
@@ -188,7 +191,9 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
}
// The controls row mutated a slider on the shared state and raised Changed. Push all four control
// uniforms (cheap scalar interop; the inert three are no-ops in the parity shader until Wave 3).
// values (cheap scalar interop). In the Phase 10 reframe Wave R2, three of them are re-routed to
// the lava physics inside the JS handle (setBubblyness→gravity, setDetach→heat,
// setColorShiftSpeed→collision) — see MixVisualizer.ts; the bridge contract is unchanged.
private void OnControlStateChanged() => InvokeAsync(async () =>
{
await PushControlsAsync();
@@ -198,8 +203,9 @@ public partial class MixWaveformVisualizer : ComponentBase, IAsyncDisposable
/// <summary>
/// Push all four control values to the module from the shared state. Used to seed on first render
/// and to re-push when the controls row signals a change. Resolution drives the live render; the
/// other three are inert in the parity shader (Wave 3 consumes them).
/// and to re-push when the controls row signals a change. Resolution drives the scroll/zoom; the
/// other three are routed to the lava physics (gravity/heat/collision) by the JS handle in
/// Wave R2 (see MixVisualizer.ts). The bridge contract is unchanged.
/// </summary>
private async Task PushControlsAsync()
{
@@ -27,23 +27,32 @@ public sealed class MixVisualizerControlState
/// </summary>
public const double DefaultVisibleSeconds = 10.0;
/// <summary>
/// Default bulge amount. Mirrors <c>DEFAULT_BUBBLYNESS</c> in MixVisualizer.ts. Normalized [0,1];
/// 0 = straight rectangular bars, 1 = fully rounded liquid silhouettes (still attached).
/// </summary>
public const double DefaultBubblyness = 0.35;
// R2 TEMP (Phase 10 reframe Wave R2): the three controls below are re-routed to the new
// lava physics for Daniel's in-browser test — the JS handle setters map them as:
// Bubblyness → lava GRAVITY, Detach → lava HEAT, ColorShiftSpeed → COLLISION STRENGTH.
// The defaults are bumped so the lava looks ALIVE on open (heat non-zero). Wave R4
// replaces this with the proper six-knob set + its own typed properties. Keep these
// mirrored to the DEFAULT_* anchors in MixVisualizer.ts, as the existing sync discipline.
/// <summary>
/// Default detach amount. Mirrors <c>DEFAULT_DETACH</c> in MixVisualizer.ts. Normalized [0,1];
/// 0 = fully attached, 1 = blobs separate and float upward. Off by default.
/// Default GRAVITY dial (R2 temp; was bulge). Mirrors <c>DEFAULT_BUBBLYNESS</c> in MixVisualizer.ts.
/// Normalized [0,1]; 0 = near-weightless float, 1 = wax falls + settles fast.
/// </summary>
public const double DefaultDetach = 0.0;
public const double DefaultBubblyness = 0.5;
/// <summary>
/// Default color-shift speed. Mirrors <c>DEFAULT_COLOR_SHIFT_SPEED</c> in MixVisualizer.ts.
/// Normalized [0,1], mapped to a gradient-morph cycle period in the shader (slow → quick).
/// Default HEAT dial (R2 temp; was detach). Mirrors <c>DEFAULT_DETACH</c> in MixVisualizer.ts.
/// Normalized [0,1]; 0 = wax rests at the bottom (collision-only), 1 = many bubbles rising.
/// Non-zero default so the lamp is alive on open.
/// </summary>
public const double DefaultColorShiftSpeed = 0.3;
public const double DefaultDetach = 0.45;
/// <summary>
/// Default COLLISION-STRENGTH dial (R2 temp; was color-shift). Mirrors
/// <c>DEFAULT_COLOR_SHIFT_SPEED</c> in MixVisualizer.ts. Normalized [0,1]; 0 = soft shove,
/// 1 = hard elastic wall.
/// </summary>
public const double DefaultColorShiftSpeed = 0.5;
/// <summary>Visible time-span in seconds (the resolution/zoom control). Reused as-is from 8.K.</summary>
public double VisibleSeconds { get; set; } = DefaultVisibleSeconds;
File diff suppressed because it is too large Load Diff