feat(web): studio worlds, camera-view/offscreen environment parity, material and undo coverage
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:
@@ -26,28 +26,21 @@ test("M12-02D publishes a catalog preview only after verified OPFS persistence",
|
||||
delete identityInput.identitySha256;
|
||||
const boundIdentity = await storage.createAssetPreviewIdentity(identityInput as never);
|
||||
|
||||
const open = (name: string): Promise<IDBDatabase> => new Promise((resolve, reject) => {
|
||||
const request = indexedDB.open(name, 1);
|
||||
request.onupgradeneeded = () => request.result.createObjectStore("setting", { keyPath: "id" });
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
const complete = (transaction: IDBTransaction): Promise<void> => new Promise((resolve, reject) => {
|
||||
transaction.oncomplete = () => resolve();
|
||||
transaction.onerror = () => reject(transaction.error);
|
||||
transaction.onabort = () => reject(transaction.error);
|
||||
});
|
||||
const get = (store: IDBObjectStore, id: string): Promise<unknown> => new Promise((resolve, reject) => {
|
||||
// Catalog rows are OPFS KV rows; the commit contract is unchanged.
|
||||
const { openKvDatabase } = await import("/src/storage/opfs-kv.ts");
|
||||
const open = (name: string) => openKvDatabase(name, ["setting"]);
|
||||
const complete = (transaction: { done: Promise<void> }): Promise<void> => transaction.done;
|
||||
const get = (store: { get(key: unknown): { result?: unknown; onsuccess: ((event?: unknown) => void) | null; onerror: ((event?: unknown) => void) | null } }, id: string): Promise<unknown> => new Promise((resolve, reject) => {
|
||||
const request = store.get(id);
|
||||
request.onsuccess = () => resolve(request.result);
|
||||
request.onerror = () => reject(request.error);
|
||||
});
|
||||
const seed = async (database: IDBDatabase): Promise<void> => {
|
||||
const seed = async (database: Awaited<ReturnType<typeof open>>): Promise<void> => {
|
||||
const transaction = database.transaction("setting", "readwrite");
|
||||
transaction.objectStore("setting").put({ id: "asset-catalog:index:v2", value: base });
|
||||
await complete(transaction);
|
||||
};
|
||||
const snapshot = async (database: IDBDatabase) => {
|
||||
const snapshot = async (database: Awaited<ReturnType<typeof open>>) => {
|
||||
const transaction = database.transaction("setting", "readonly");
|
||||
const store = transaction.objectStore("setting");
|
||||
const [index, receipt] = await Promise.all([
|
||||
@@ -69,6 +62,10 @@ test("M12-02D publishes a catalog preview only after verified OPFS persistence",
|
||||
}
|
||||
catch { return false; }
|
||||
};
|
||||
const dropKvDatabase = async (name: string): Promise<void> => {
|
||||
const kv = await (await navigator.storage.getDirectory()).getDirectoryHandle("_kv_v1");
|
||||
await kv.removeEntry(name, { recursive: true });
|
||||
};
|
||||
const cleanupProject = async (projectId: string): Promise<void> => {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
try {
|
||||
@@ -92,7 +89,7 @@ test("M12-02D publishes a catalog preview only after verified OPFS persistence",
|
||||
const state = await snapshot(database);
|
||||
const persisted = await payloadExists(projectId);
|
||||
database.close();
|
||||
indexedDB.deleteDatabase(databaseName);
|
||||
await dropKvDatabase(databaseName);
|
||||
await cleanupProject(projectId);
|
||||
return { faultAt, code, state, persisted };
|
||||
};
|
||||
@@ -113,7 +110,7 @@ test("M12-02D publishes a catalog preview only after verified OPFS persistence",
|
||||
const successState = await snapshot(database);
|
||||
const persisted = await payloadExists(projectId);
|
||||
database.close();
|
||||
indexedDB.deleteDatabase(databaseName);
|
||||
await dropKvDatabase(databaseName);
|
||||
await cleanupProject(projectId);
|
||||
return {
|
||||
base,
|
||||
|
||||
Reference in New Issue
Block a user