Video: one slab list for montage and exit; a render check for the recordings at the cut (R2.3)
This commit is contained in:
11 files changed
+70
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
// Montage: six screens on the turning model, in WebGL.
|
||||
import { model } from "../../src/model.ts";
|
||||
import { type Box, grown, screens } from "../scenes/parts.ts";
|
||||
import { type Box, screens } from "../scenes/parts.ts";
|
||||
import { slabs } from "../scenes/turn.ts";
|
||||
import { BEAT, glide, toward } from "../scenes/time.ts";
|
||||
import recs from "./recs.json";
|
||||
|
||||
@@ -14,7 +15,6 @@ const TURN: [number, number] = [128, 136];
|
||||
const PIVOT = [8, 5.5];
|
||||
const apps = recs.apps;
|
||||
|
||||
const slabs = apps.map((a) => grown(a.app));
|
||||
const ground = model.flatMap((p) => p.blocks).filter((b) => b !== screens.ElyShow);
|
||||
|
||||
type Rgb = [number, number, number];
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"render": "node render.mjs",
|
||||
"check": "tsc -p ."
|
||||
"check": "tsc -p .",
|
||||
"verify": "node verify.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"playwright": "1.64.0"
|
||||
|
||||
@@ -164,7 +164,7 @@ export const props: Prop[] = [
|
||||
},
|
||||
];
|
||||
|
||||
/** A screen grown about its bottom centre; Show on its base. */
|
||||
/** A screen grown about its base; Show stands apart. */
|
||||
export function grown(app: string): Box {
|
||||
if (app === "ElyShow") return { x: 8.6, y: 2, z: model[0].blocks[0].h + 0.25, w: 4.8, d: 0.08, h: 2.7, tone: SCREEN };
|
||||
const b = screens[app];
|
||||
|
||||
@@ -17,7 +17,7 @@ export function turned(a: number, x: number, y: number, z: number): [number, num
|
||||
/** The montage's grown screens, which leave in bar 35. */
|
||||
export const slabs: Box[] = recs.apps.map(({ app }) => grown(app));
|
||||
|
||||
/** The recording a leaving slab plays at frame `f`, if any. */
|
||||
/** A leaving slab's recording at frame `f`, if any. */
|
||||
export function recording(box: Box, land: number, f: number): string | null {
|
||||
const slab = slabs.indexOf(box);
|
||||
if (slab < 0 || land <= 0) return null;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Checks the leaving screens play their recordings at the cut.
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { chromium } from "playwright";
|
||||
import { createServer } from "vite";
|
||||
import recs from "../montage/recs.json" with { type: "json" };
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const server = await createServer({ root: resolve(here, "../.."), configFile: false, logLevel: "error", server: { port: 0 } });
|
||||
await server.listen();
|
||||
const browser = await chromium.launch();
|
||||
try {
|
||||
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } });
|
||||
page.on("pageerror", (e) => {
|
||||
throw e;
|
||||
});
|
||||
// Any frame will do; only which frame is asked matters.
|
||||
await page.route("**/rec/**", (route) => route.fulfill({ path: resolve(here, "../../public/film/poster.jpg") }));
|
||||
await page.goto(`${server.resolvedUrls.local[0]}video/scenes/index.html`, { waitUntil: "networkidle" });
|
||||
// The first frame after the montage is the cut.
|
||||
const cut = recs.first + 129;
|
||||
for (const f of [cut, cut + 1, cut + 2]) {
|
||||
await page.evaluate((f) => window.ely.render("files", f), f);
|
||||
const hrefs = await page.$$eval("#world image", (els) => els.map((el) => el.getAttribute("href")));
|
||||
const want = String(f - recs.first + 1).padStart(5, "0");
|
||||
if (hrefs.length !== 6 || !hrefs.every((h) => h.endsWith(`/${want}.jpg`)) || new Set(hrefs).size !== 6) {
|
||||
throw new Error(`frame ${f}: ${hrefs.length} recordings ${JSON.stringify(hrefs)}`);
|
||||
}
|
||||
}
|
||||
console.log("verify: six screens play their own frames across the cut");
|
||||
} finally {
|
||||
await browser.close();
|
||||
await server.close();
|
||||
}
|
||||
Reference in new issue
Block a user