Files
workinf_Blender_Wasm/docs/status/W-077.md
2026-08-12 04:47:48 -04:00

2.8 KiB

W-077 Status

status: in_progress
task: 多级 LOD 生成、缓存和视口选择

The cache boundary is now implemented without changing the native WASM ABI:

  • buildLODCacheKey creates a deterministic, path-safe key from object ID, source mesh revision, modifier-stack hash, profile hash and REST/POSE state.
  • IndexedDB schema v3 adds lod_manifest; the StorageWorker can put/get a validated manifest and writes transferable .mesh bytes to OPFS projects/<id>/cache/lod/<cacheKey>.mesh. Read, delete and byte-budget pruning update lastAccessAt and remove the least-recently-used entries.
  • ThreeLODAdapter selects pre-generated levels from projected pixel height, with a configurable hysteresis band, and is updated by the viewport render loop without rebuilding the imported scene.
  • generateLOD evaluates every requested profile independently from the source .blend in a fresh WASM module instance, returns a validated manifest and transferable geometry, and is exposed by the React inspector. A binary length-table container round-trips the level buffers before OPFS persistence; the React path reads that persisted container back before installing levels into the Three.js viewport, while preserving source transforms and materials.
  • Browser E2E covers the OPFS bytes, manifest round trip, stable key and hysteresis behavior, multi-level generation and binary geometry round trips.

The React open path now lists all lod_manifest rows for the project after a fresh application load, filters them by the authoritative SceneIR revision and object IDs, reads the OPFS .mesh container, validates the level mesh IDs and installs the cached levels into the Three.js LOD adapter. Applying any native scene command also removes manifests from older source revisions, so a stale cache cannot be selected after a mesh or modifier edit. Browser E2E covers generation, reload, discovery and reuse.

Pose-aware skin joints are still not exported into the LOD manifest. The native Collapse bridge now performs one Blender BMesh collapse pass at a time, creating a fresh heap for each pass and recalculating the quadric choice from the current mesh state. This removes the previous WASM memory failure at intermediate cube targets; the LOD Worker keeps per-level isolation as a general fault boundary. An active modifier stack must now have an EVALUATED dependency-graph report before LOD generation. Metadata-only and unresolved stacks return a structured capability error rather than caching output from an implicit base mesh. Each isolated LOD profile applies the same skin/shape-key preflight as direct Decimate, so a valid skinPolicy receives native remapping while a missing or rejecting policy cannot create a partial cache entry. Full Blender parity still requires pose-aware skin joints and broader Blender golden coverage, so the task stays in_progress.