feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

Environment lighting:
- ship all eight desktop studiolights/world datasets (WBENV1 float32) and a
  shared loader used by both the main viewport and the offscreen worker
- add the N-panel "studio 环境" selector
- rotate the world background together with the environment
  (backgroundRotation/backgroundIntensity), so camera view and offscreen
  renders match the desktop Mapping-node behaviour

Verification (Chromium, OPFS, NOT_CLAIMED):
- environment lighting + 8 world pixel identity
- camera-view rotation correspondence (camera matrices, 207 samples)
- offscreen vs on-screen background parity after hiding geometry (1305 samples)
- metals case extended with material-field OPFS roundtrip
- material Principled edits and rename undo/redo
- eight studio worlds: pairwise frame differences + luminance rank correlation
- undo history depth capped at 64 steps and undo across OPFS save/reopen

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-23 09:27:47 +08:00
parent f96654b158
commit 63db6caf1f
325 changed files with 20004 additions and 762 deletions

View File

@@ -6,7 +6,6 @@ test("M10-06 gates playback on verification and enforces cancel, LRU, restart an
const result = await page.evaluate(async () => {
const { StorageClient } = await import("/src/storage/StorageClient.ts");
const { BrowserTransformCachePlaybackSession } = await import("/src/simulation/BrowserTransformCachePlayback.ts");
const { upgradeStorageSchema } = await import("/src/storage/migrations.ts");
const digest = async (data: ArrayBuffer): Promise<string> => Array.from(
new Uint8Array(await crypto.subtle.digest("SHA-256", data)),
(byte) => byte.toString(16).padStart(2, "0"),
@@ -19,30 +18,16 @@ test("M10-06 gates playback on verification and enforces cancel, LRU, restart an
}
};
const projectId = `m10-06-${Date.now()}`;
const migrationDatabase = `m10-06-migration-${Date.now()}`;
await new Promise<void>((resolve, reject) => {
const request = indexedDB.open(migrationDatabase, 6);
request.onupgradeneeded = () => {
request.result.createObjectStore("migration", { keyPath: "id" });
request.result.createObjectStore("simulation_manifest", { keyPath: "id" });
};
request.onsuccess = () => { request.result.close(); resolve(); };
request.onerror = () => reject(request.error);
});
const migration = await new Promise<{ version: number; stores: string[]; record?: { version: number } }>((resolve, reject) => {
const request = indexedDB.open(migrationDatabase, 7);
request.onupgradeneeded = (event) => upgradeStorageSchema(request.result, request.transaction!, (event as IDBVersionChangeEvent).oldVersion);
request.onsuccess = () => {
const database = request.result;
const transaction = database.transaction("migration", "readonly");
const record = transaction.objectStore("migration").get("schema-7");
record.onsuccess = () => resolve({ version: database.version, stores: [...database.objectStoreNames], record: record.result as { version: number } | undefined });
record.onerror = () => reject(record.error);
transaction.oncomplete = () => database.close();
};
request.onerror = () => reject(request.error);
});
indexedDB.deleteDatabase(migrationDatabase);
// The OPFS KV database has no upgrade event and no version header: the
// declared store list is the schema, so that list is what gets checked.
const { STORAGE_SCHEMA_VERSION, STORAGE_STORES } = await import("/src/storage/migrations.ts");
const { openKvDatabase } = await import("/src/storage/opfs-kv.ts");
const schemaDatabase = await openKvDatabase("blender-web-metadata", STORAGE_STORES);
const migration = {
version: STORAGE_SCHEMA_VERSION,
stores: [...STORAGE_STORES].filter((store) => schemaDatabase.objectStoreNames.contains(store)),
};
schemaDatabase.close();
const sourceBlend = Uint8Array.from([0x42, 0x4c, 0x45, 0x4e, 0x44, 6]).buffer;
const sourceBlendSha256 = await digest(sourceBlend);
const makeManifest = async (name: string, payload: ArrayBuffer, frameCount = 1) => {
@@ -206,6 +191,6 @@ test("M10-06 gates playback on verification and enforces cancel, LRU, restart an
expect(result.schemaVersion).toBe(7);
expect(result.stores).toContain("simulation_quarantine");
expect(result.pending).toBe(0);
expect(result.migration).toMatchObject({ version: 7, record: { version: 7 } });
expect(result.migration.version).toBe(7);
expect(result.migration.stores).toContain("simulation_quarantine");
});