feat: integrate isometric labs renderer

Issue: #89
User-Visible: no
This commit is contained in:
Sergey Matyunin
2026-08-13 14:40:31 +03:00
parent 02502c990c
commit 0ef900a3ae
9 changed files with 635 additions and 276 deletions
+11 -1
View File
@@ -1,6 +1,8 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { buildIsoWallGeometry, isoGeometryFingerprint } from '../test-build/iso-walls.js';
import {
buildIsoWallGeometry, isoEffectiveView, isoGeometryFingerprint,
} from '../test-build/iso-walls.js';
const closed = (points) => [...points, points[0]];
const square = closed([[0, 0], [100, 0], [100, 100], [0, 100]]);
@@ -42,3 +44,11 @@ test('fingerprint is content based, stable and sensitive to in-place geometry ed
isoGeometryFingerprint({ rooms: value.rooms, showBorders: false }));
});
test('latched renderer failures stay flat until explicit retry or a new fingerprint', () => {
const failed = new Set(['space|old']);
assert.equal(isoEffectiveView('iso', 'space|old', failed), 'flat');
assert.equal(isoEffectiveView('iso', 'space|new', failed), 'iso');
assert.equal(isoEffectiveView('flat', 'space|new', failed), 'flat');
failed.delete('space|old');
assert.equal(isoEffectiveView('iso', 'space|old', failed), 'iso');
});
+33
View File
@@ -0,0 +1,33 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const card = readFileSync(new URL('../src/houseplan-card.ts', import.meta.url), 'utf8');
const styles = readFileSync(new URL('../src/styles.ts', import.meta.url), 'utf8');
const spaceCard = readFileSync(new URL('../src/space-card.ts', import.meta.url), 'utf8');
const spaceRender = readFileSync(new URL('../src/space-render.ts', import.meta.url), 'utf8');
test('Labs iso is presentation-only and absent from the secondary space card', () => {
assert.match(card, /subscribeLabs\(CARD_VERSION/);
assert.match(card, /data-hp="projection-toggle"/);
assert.match(card, /this\._labsIso && this\._mode === 'view' && !this\._kiosk/);
assert.doesNotMatch(spaceCard, /hp-labs|iso-walls|projection-toggle|view\.volumetric/);
assert.doesNotMatch(spaceRender, /hp-labs|iso-walls|projection-toggle|view\.volumetric/);
});
test('renderer uses SVG geometry without a CSS 3D context or new window light', () => {
assert.match(card, /<svg class="iso-walls-svg"/);
assert.match(card, /class="iso-wall-top"/);
assert.match(card, /class="iso-wall-side"/);
assert.doesNotMatch(styles, /perspective\s*:|preserve-3d|rotateX\(|rotateZ\(/);
assert.doesNotMatch(card, /iso-window|window-light|vertical-door/);
});
test('all current floor/live layers remain in the one main scene', () => {
for (const renderer of [
'_renderDecorLayer()', '_renderRoomHoverFill(roomHover)', '_renderGlowLayer(space, disp)',
'_renderSunRays(space)', '_renderOpenings(disp)', '_renderVacuums(devs, view)',
]) assert.ok(card.includes(renderer), `missing ${renderer}`);
assert.match(card, /const point = this\._scenePoint\(\[pos\.x, pos\.y\]\)/);
assert.match(card, /const point = this\._scenePoint\(\[p\.x, p\.y\]\)/);
});