Advance WebGPU volume and bounded workflows

This commit is contained in:
mes123456
2026-08-14 18:08:29 -04:00
parent 3da1dfc804
commit 68d50f810f
119 changed files with 9028 additions and 430 deletions

View File

@@ -1,4 +1,4 @@
import type { AnimationIR, CameraIR, LightIR, MaterialIR, MeshSummaryIR, SceneNodeIR, SceneSnapshotIR } from "./scene-ir";
import type { AnimationIR, CameraIR, LightIR, MaterialIR, MeshSummaryIR, SceneIR, SceneNodeIR, SceneSnapshotIR, WorldIR } from "./scene-ir";
export interface SceneCollectionDelta<T extends { id: string }> {
updated: Array<Pick<T, "id"> & Partial<T>>;
@@ -20,11 +20,13 @@ export interface SceneDelta {
animations?: SceneCollectionDelta<AnimationIR>;
cameras?: SceneCollectionDelta<CameraIR>;
lights?: SceneCollectionDelta<LightIR>;
worlds?: SceneCollectionDelta<WorldIR>;
scenes?: SceneCollectionDelta<SceneIR>;
activeObjectId?: string | null;
frame?: SceneSnapshotIR["frame"];
}
const collectionFields = ["meshes", "materials", "animations", "cameras", "lights"] as const;
const collectionFields = ["meshes", "materials", "animations", "cameras", "lights", "worlds", "scenes"] as const;
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -115,6 +117,8 @@ export function diffSceneSnapshots(before: SceneSnapshotIR, after: SceneSnapshot
delta.animations = diffCollection(before.animations, after.animations);
delta.cameras = diffCollection(before.cameras, after.cameras);
delta.lights = diffCollection(before.lights, after.lights);
delta.worlds = diffCollection(before.worlds, after.worlds);
delta.scenes = diffCollection(before.scenes, after.scenes);
if (before.activeObjectId !== after.activeObjectId) delta.activeObjectId = after.activeObjectId;
if (JSON.stringify(before.frame) !== JSON.stringify(after.frame)) delta.frame = after.frame;
return delta;
@@ -153,7 +157,14 @@ export function applySceneDelta(snapshot: SceneSnapshotIR, delta: SceneDelta): S
animations: applyCollectionDelta(snapshot.animations, delta.animations),
cameras: applyCollectionDelta(snapshot.cameras, delta.cameras),
lights: applyCollectionDelta(snapshot.lights, delta.lights),
worlds: applyCollectionDelta(snapshot.worlds, delta.worlds),
scenes: applyCollectionDelta(snapshot.scenes, delta.scenes),
activeObjectId: delta.activeObjectId === undefined ? snapshot.activeObjectId : delta.activeObjectId,
frame: delta.frame ?? snapshot.frame,
};
}
export function sceneDeltaRequiresRendererRebuild(delta: SceneDelta): boolean {
return Boolean(delta.nodes?.added?.length || delta.nodes?.removed?.length || delta.meshes || delta.materials ||
delta.cameras || delta.lights || delta.worlds || delta.scenes || delta.animations);
}