mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-11 04:44:31 +00:00
refactor(h3d-carve-9): extract W-section (camera lerp) → src/camera.js
effectiveVfov + camUpdate (~192 lines) extracted from the screen.js IIFE
into a createCamera() ES-module factory in plugins/highway_3d/src/camera.js.
screen.js imports and destructures the return { effectiveVfov, camUpdate }.
DI surface (48 params): 22 plain constants, 11 getters, 5 getter+setter pairs,
5 fn-refs (DI-renamed: _freeCamFor→freeCamFor, _aspectPaneKey→aspectPaneKey,
_resolveTuneFor→resolveTuneFor, _aspectRegisterPane→aspectRegisterPane).
Peer ES imports at module level: computeBPM (geometry.js), _ssActive (utils.js).
Per-call write-backs: setCurX, setCurDist, setCurLookY, setTgtLookY,
setFretRowFitBoost (all write-backs confirmed by setter class-killer tests).
Test retargeting (54 tests across 4 files):
- highway_3d_wide_fov.test.js: 6 tests → cameraSrc; 4 regexes updated for
DI-renamed fn refs (resolveTuneFor, aspectRegisterPane, aspectPaneKey/getPaneUid)
- highway_3d_camera_framing.test.js: 5 tests → cameraSrc; getTgtDist() regex fix
- highway_3d_camera_bootstrap.test.js: extractFn retargeted to cameraSrc;
getTgtX() ordering-check fix; 2 new setter class-killers added (setCurX,
setFretRowFitBoost)
- highway_3d_lefty.test.js: shoulder-offset test → cameraSrc + getLeftyCached()
- highway_3d_panel_controls.test.js: createCamera stub added
Bite proofs:
- Gut effectiveVfov in camera.js → wide_fov not ok 4 (RED) ✓
- Gut camUpdate body (H_NEAR lerp) → framing not ok 3 (RED) ✓
- Gut camUpdate body (curX+=) → bootstrap not ok 11 (RED) ✓
- Sever setCurX → bootstrap not ok 12 (RED) ✓
- Sever setFretRowFitBoost → bootstrap not ok 13 (RED) ✓
Suite: 1271/1273 pass; 2 pre-existing failures unchanged from cut-8 baseline
(#46 analyser fallback, #591 nut-labels — both in flight before cut 9).
plugin.json: 3.44.0 → 3.45.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uZ169yfoFYArXz962g7KW
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
4a45ed8782
commit
10c7ec8a9d
@@ -16,6 +16,9 @@ const src = fs.readFileSync(SCREEN_JS, 'utf8');
|
||||
// Since h3d-carve-1b, hwyFirstRelevantFrettedTime lives in geometry.js.
|
||||
const GEOMETRY_JS = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'src', 'geometry.js');
|
||||
const geoSrc = fs.readFileSync(GEOMETRY_JS, 'utf8');
|
||||
// h3d-carve-9: camUpdate body moved to camera.js — extractFn retargets there.
|
||||
const CAMERA_JS = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'src', 'camera.js');
|
||||
const cameraSrc = fs.readFileSync(CAMERA_JS, 'utf8');
|
||||
|
||||
function extractFn(source, name) {
|
||||
const start = source.indexOf('function ' + name);
|
||||
@@ -209,8 +212,10 @@ test('Camera Director still layers after the bootstrapped auto-framing base', ()
|
||||
'bootstrap must only initialize base framing, never mutate Camera Director state',
|
||||
);
|
||||
|
||||
const camUpdate = extractFn(src, 'camUpdate');
|
||||
const baseIndex = camUpdate.indexOf('curX += (tgtX - curX) * lerp');
|
||||
// h3d-carve-9: extractFn must target cameraSrc — src holds only the tombstone.
|
||||
// tgtX is DI-rewired to getTgtX() direct call in camera.js.
|
||||
const camUpdate = extractFn(cameraSrc, 'camUpdate');
|
||||
const baseIndex = camUpdate.indexOf('curX += (getTgtX() - curX) * lerp');
|
||||
const directorIndex = camUpdate.indexOf('if (_freeCam && _freeCam.enabled)');
|
||||
const positionIndex = camUpdate.indexOf('cam.position.set(_camX, _camY, _camZ)');
|
||||
assert.ok(
|
||||
@@ -218,3 +223,25 @@ test('Camera Director still layers after the bootstrapped auto-framing base', ()
|
||||
'Camera Director transforms must remain layered after base framing and before camera placement',
|
||||
);
|
||||
});
|
||||
|
||||
// ── h3d-carve-9: setter class-killers (write-back pairs must survive DI) ────
|
||||
// Severing the call turns the test RED: a silent local var replaces the
|
||||
// write-back and the IIFE-scope var is never updated.
|
||||
|
||||
test('setCurX write-back is called in camUpdate (curX persists across frames)', () => {
|
||||
// Silencing: sed 's/setCurX(curX)/\/\/ GUTTED/' → this test fails.
|
||||
assert.match(
|
||||
cameraSrc,
|
||||
/setCurX\(\s*curX\s*\)/,
|
||||
'camUpdate must write curX back via setCurX(); removing it silences the update',
|
||||
);
|
||||
});
|
||||
|
||||
test('setFretRowFitBoost write-back is called in camUpdate (boost persists across frames)', () => {
|
||||
// Silencing: sed 's/setFretRowFitBoost(_fretRowFitBoost)/\/\/ GUTTED/' → RED.
|
||||
assert.match(
|
||||
cameraSrc,
|
||||
/setFretRowFitBoost\(\s*_fretRowFitBoost\s*\)/,
|
||||
'camUpdate must write _fretRowFitBoost back via setFretRowFitBoost(); removing it silences the boost',
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user