mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-17 02:10:12 +00:00
h3d-carve-13: extract S-section lookahead helpers into src/camera.js
Partial cut (Option A) per contract ~/Feedback-harness/hive/plans/h3d-cut13-contract.md. What moves: - lookaheadEndTime (factory-private) — 1 beyond-subst: _measureStarts → getMeasureStarts() - lookaheadBootstrapTime (exported) - lookaheadComputeFretBounds (exported) — uses lowerBoundT from geometry.js (new import) - lookaheadTargetWorldX (exported) DI delta: +9 params to createCamera() Constants (+4): NFRETS=24, CAM_LOOKAHEAD_MEASURES=9, CAM_LOOKAHEAD_SEC=3.0, CAM_FRET_EDGE_BLEND=0.1 Getter (+1): getMeasureStarts: () => _measureStarts Fn refs (+4): validString, getChartAnchorAt, xFretMid, xFret Total createCamera() DI: 57 (was 48) Deferred to cut 15 (U-section entanglement): lookaheadSmoothCamStep, _applyNoteCamTargets — write S-section state vars Region B (per-frame cam target block, ~90 lines) — reads 8 update() locals Region C (song-change + bootstrap block, ~174 lines) — U-section init code Call sites unchanged (destructured names unchanged): lookaheadComputeFretBounds: lines 7474, 7941 lookaheadBootstrapTime: line 7939 lookaheadTargetWorldX: lines 7943, 10062 Tests: 17 new (highway_3d_camera_lookahead.test.js), 2 retargeted to cameraSrc. Suite: 1353/1355 pass (2 pre-existing failures in unrelated test files). 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
e230629770
commit
66aa829362
@@ -98,27 +98,29 @@ test('measure-start cache only keeps beats with measure >= 0', () => {
|
||||
});
|
||||
|
||||
test('lookaheadEndTime targets the measure CAM_LOOKAHEAD_MEASURES ahead', () => {
|
||||
// h3d-carve-13: lookaheadEndTime moved to src/camera.js — retarget to cameraSrc.
|
||||
assert.match(
|
||||
src,
|
||||
cameraSrc,
|
||||
/function\s+lookaheadEndTime\s*\(\s*now\s*\)/,
|
||||
'lookaheadEndTime(now) helper must exist',
|
||||
);
|
||||
assert.match(
|
||||
src,
|
||||
cameraSrc,
|
||||
/const\s+targetIdx\s*=\s*curIdx\s*\+\s*CAM_LOOKAHEAD_MEASURES/,
|
||||
'target measure index = current measure + CAM_LOOKAHEAD_MEASURES',
|
||||
);
|
||||
// No beats → seconds fallback.
|
||||
assert.match(
|
||||
src,
|
||||
cameraSrc,
|
||||
/if\s*\(\s*!ms\s*\|\|\s*ms\.length\s*===\s*0\s*\)\s*return\s+now\s*\+\s*CAM_LOOKAHEAD_SEC/,
|
||||
'lookaheadEndTime must fall back to seconds when there are no measures',
|
||||
);
|
||||
});
|
||||
|
||||
test('fret-bounds scan drives its window off lookaheadEndTime, not fixed seconds', () => {
|
||||
// h3d-carve-13: lookaheadComputeFretBounds moved to src/camera.js — retarget to cameraSrc.
|
||||
assert.match(
|
||||
src,
|
||||
cameraSrc,
|
||||
/function\s+lookaheadComputeFretBounds[\s\S]*?const\s+tEnd\s*=\s*lookaheadEndTime\(\s*now\s*\)/,
|
||||
'lookaheadComputeFretBounds must derive tEnd from lookaheadEndTime(now)',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user