mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-13 08:29:28 +00:00
refactor(h3d-carve-6): move N-section material builders to src/materials.js
Extract TXT_STYLES + 13 material builder functions (txtMat, pinchHarmonicMat,
naturalHarmonicMat, palmMuteXSpriteMat, fretHandMuteXSpriteMat, muteXMat,
triMat, bendChevronMat, darkenHex, slideArrowMat, _meshMatForGhostFretDigit,
_spriteMat2MeshMat) and pool() from screen.js N-section into:
plugins/highway_3d/src/materials.js (createMaterialBuilders factory)
screen.js drops ~600 lines (15302→14705).
Surprises vs plan §4:
• DI is 4 params { getT, getTxtCache, techMatCache, techMeshMatClones } not 1
• _syncOpenStringPitchLabels cluster excluded (20+ factory-scope deps)
• _techMatCache stays in screen.js factory scope for teardown .values()/.clear()
Beyond-subst (4):
1. Factory wrapper createMaterialBuilders({...})
2. T → const T = getT() inside each function body (live accessor)
3. txtCache[k] → const cache = getTxtCache(); cache[k]
4. _techMatCache/_techMeshMatClones → DI param names techMatCache/techMeshMatClones
Tests: 16 new class-killer tests in highway_3d_materials.test.js;
pool warm tests retargeted to src/materials.js; panel_controls stub added.
Full suite: 1246/1248 pass (2 pre-existing: network + nut-labels).
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
733d772154
commit
e6b2f86068
@@ -15,6 +15,8 @@ const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const SCREEN_JS = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'screen.js');
|
||||
// h3d-carve-6: pool() moved to src/materials.js; warm() call-sites remain in screen.js.
|
||||
const MATERIALS_JS = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'src', 'materials.js');
|
||||
|
||||
// Brace-balanced extraction so warm() / coercion checks scope to the
|
||||
// `function pool(...)` body (matching the helper shape used in
|
||||
@@ -39,7 +41,8 @@ function extractBlock(src, signature) {
|
||||
}
|
||||
|
||||
test('pool factory exposes warm(cap)', () => {
|
||||
const src = fs.readFileSync(SCREEN_JS, 'utf8');
|
||||
// h3d-carve-6: pool() lives in src/materials.js (createMaterialBuilders).
|
||||
const src = fs.readFileSync(MATERIALS_JS, 'utf8');
|
||||
// The pool() factory's return object must include a `warm(cap)`
|
||||
// method. Scope the match to the factory body so an unrelated
|
||||
// future `warm(cap)` helper elsewhere in the file can't satisfy
|
||||
@@ -49,7 +52,8 @@ test('pool factory exposes warm(cap)', () => {
|
||||
});
|
||||
|
||||
test('pool.warm coerces cap to a non-negative integer', () => {
|
||||
const src = fs.readFileSync(SCREEN_JS, 'utf8');
|
||||
// h3d-carve-6: pool() lives in src/materials.js (createMaterialBuilders).
|
||||
const src = fs.readFileSync(MATERIALS_JS, 'utf8');
|
||||
// Same scoping discipline as above — the coercion must live
|
||||
// inside the pool factory's warm() body, not anywhere else.
|
||||
const poolBody = extractBlock(src, 'function pool(parent, mk)');
|
||||
|
||||
Reference in New Issue
Block a user