mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-11 04:44:31 +00:00
Moves 7 exports from screen.js to a new ES module src/geometry.js: geoFretX (was fretX, now 2-arg), dZ, slideTrailEnd, camBaseDistU, camLowFretPullbackU, computeBPM, _makeGaussTex. Internal helpers _fretXLog / _fretXUniStep / _fretXUni are module-private inside geometry.js. Module-level constants (SCALE, K, FRET_SCALE, NFRETS, FRET_SPACING_*, TS) are duplicated at geometry.js module scope — values are compile-time and never vary at runtime. screen.js keeps a 1-arg delegator (1 beyond-subst): const fretX = f => geoFretX(f, _h3dFretUniform); No call site changes; fretMid / fretColumnWorldW / slideOffsetWorldX / _recomputeFretSpacingDerived stay in screen.js and use the delegator. Tests: - highway_3d_geometry.test.js: class-killer via import() with 9 known-answer assertions (geoFretX uniform/log invariants, dZ linearity, slideTrailEnd, computeBPM BPM estimate). - highway_3d_fret_spacing: test updated to match delegator pattern + adds GEOMETRY_JS read to verify geoFretX export. - highway_3d_sustain_bloom: retargeted _makeGaussTex check to GEOMETRY_JS (definition moved); call-site check stays on SCREEN_JS. - highway_3d_panel_controls: vm loader strips ES import line and injects geometry stubs; all factory-statics tests unaffected. Suite: 169/169 pass node --test tests/js/highway_3d*.test.js plugins/highway_3d/tests/*.test.js Version bump: 3.35.0 -> 3.36.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uZ169yfoFYArXz962g7KW
56 lines
2.4 KiB
JavaScript
56 lines
2.4 KiB
JavaScript
// Pins the sustain bloom glow in plugins/highway_3d/screen.js (PR #329).
|
|
// Sustained chord rails get a soft gaussian glow: a DataTexture gaussian
|
|
// (_makeGaussTex) drives a wider, additive-blended plane mesh (pSusRailBloom)
|
|
// rendered behind the core rail. A refactor that drops the gaussian texture,
|
|
// stops using additive blending, or bumps the bloom renderOrder above the
|
|
// core rail (16) would silently regress or invert the effect.
|
|
//
|
|
// Since h3d-carve-1, _makeGaussTex is defined in src/geometry.js and
|
|
// imported into screen.js; the call site (_bloomGaussTex = _makeGaussTex(...))
|
|
// remains in screen.js.
|
|
//
|
|
// Source-level only — same strategy as the other tests/js/ files.
|
|
|
|
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const SCREEN_JS = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'screen.js');
|
|
const GEOMETRY_JS = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'src', 'geometry.js');
|
|
|
|
test('a gaussian DataTexture helper (_makeGaussTex) drives the bloom falloff', () => {
|
|
const geo = fs.readFileSync(GEOMETRY_JS, 'utf8');
|
|
assert.match(
|
|
geo,
|
|
/export\s+function\s+_makeGaussTex\s*\(/,
|
|
'_makeGaussTex must be exported from geometry.js to build the bloom gaussian texture',
|
|
);
|
|
const src = fs.readFileSync(SCREEN_JS, 'utf8');
|
|
assert.match(
|
|
src,
|
|
/_bloomGaussTex\s*=\s*_makeGaussTex\(/,
|
|
'the bloom texture must be produced by _makeGaussTex',
|
|
);
|
|
});
|
|
|
|
test('the bloom rail material uses additive blending', () => {
|
|
const src = fs.readFileSync(SCREEN_JS, 'utf8');
|
|
assert.match(
|
|
src,
|
|
/mSusRailBloomBase\s*=\s*new\s+T\.MeshBasicMaterial\(\{[\s\S]*?blending:\s*T\.AdditiveBlending[\s\S]*?\}\)/,
|
|
'mSusRailBloomBase must blend additively so it brightens what is behind it',
|
|
);
|
|
});
|
|
|
|
test('the bloom pool seeds meshes at renderOrder 4, behind the core rail (5)', () => {
|
|
// renderOrder 4 keeps the bloom behind the core sustain rail (5) so the
|
|
// glow reads as a trail rather than occluding the rail.
|
|
const src = fs.readFileSync(SCREEN_JS, 'utf8');
|
|
assert.match(
|
|
src,
|
|
/pSusRailBloom\s*=\s*pool\([^)]*,\s*\(\)\s*=>\s*\{[\s\S]*?m\.renderOrder\s*=\s*4\s*;[\s\S]*?\}\s*\)/,
|
|
'pSusRailBloom pool must seed meshes with renderOrder = 4',
|
|
);
|
|
});
|