feat(highway_3d): cap the fret-wire flash at one outer pair

Fast passages overlap their decay tails: consecutive notes on nearby
frets left three, four, five wires glowing at once — the picket fence
the chord rule was written to avoid, arriving through time instead of
through a shape.

The apply pass now decays every wire's glow state as before, but flashes
only the outermost pair of the lit span (or the single wire when only
one is above threshold). Interior wires keep decaying invisibly — the
base tier loop re-seeds their materials each frame — so the bracket
tightens naturally as the outer tails expire, and a hit inside the
current span widens nothing.

Net effect: at most two wires are ever lit, and everything currently
glowing reads as one bracket, exactly like a chord.

Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
topkoa
2026-07-18 20:05:30 -04:00
parent 41801d92df
commit 859a62e84a
2 changed files with 23 additions and 3 deletions
+19 -1
View File
@@ -12680,10 +12680,28 @@
? Math.exp(-_fwDt / FRET_WIRE_HIT_DECAY)
: 0;
_fwHitPrevTime = now;
// Decay EVERY wire's glow state, but flash only the OUTERMOST
// pair of lit wires. Fast passages overlap their decay tails, so
// without this a run of consecutive notes lights a picket fence
// of wires at once; collapsing to the outer pair keeps the whole
// lit span reading as ONE bracket — the same rule chords already
// follow, applied across everything currently glowing. Interior
// wires keep decaying invisibly (the base tier loop re-seeds
// their materials each frame), so the bracket tightens naturally
// as outer tails expire.
let _fwLo = -1, _fwHi = -1;
for (let _f = 0; _f <= NFRETS; _f++) {
const _g = Math.max(_fwHitIn[_f], _fwHitGlow[_f] * _fwDecay);
_fwHitGlow[_f] = _g;
if (_g < 0.004) continue; // below perceptible — skip the lerps
if (_g < 0.004) continue; // below perceptible
if (_fwLo < 0) _fwLo = _f;
_fwHi = _f;
}
for (let _i = 0; _i < 2; _i++) {
const _f = _i === 0 ? _fwLo : _fwHi;
if (_f < 0) break; // nothing lit
if (_i === 1 && _f === _fwLo) break; // single wire lit
const _g = _fwHitGlow[_f];
const _m = fretWireMats[_f];
if (!_m) continue;
_m.color.lerp(_fwHitColor, _g);