/** * Build an HTML harness that renders one generated SVG two ways: * left = inline in the DOM (what the preview does — lenient HTML parser) * right = rasterised to a via Image (what scene.mjs does) * Used with Playwright to reproduce the "missing content in scene" bug. */ import { writeFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { dirname, join } from "node:path"; import { Rng } from "../module/lib/rng.mjs"; import { generateBuilding } from "../module/lib/building.mjs"; import { buildWalls } from "../module/lib/walls.mjs"; import { renderSVG } from "../module/lib/render-vector.mjs"; const here = dirname(fileURLToPath(import.meta.url)); const layout = generateBuilding({ cols: 26, rows: 18, targetRooms: 11, subtype: "modern", seed: "mire-680", shape: "rectangle" }); const walls = buildWalls(layout, { rng: new Rng("mire-680::walls::0") }); const svg = renderSVG({ layout, walls, gridSize: 100, subtype: "modern", seed: "mire-680::0" }); const W = layout.cols * 100, H = layout.rows * 100; const html = `

A: inline SVG (preview)

${svg}

B: SVG→canvas

C: →PNG blob→reload (final scene bytes)

`; writeFileSync(join(here, "raster-test.html"), html); console.log("wrote", join(here, "raster-test.html"), "size", svg.length);