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

2.5 KiB

W-078 Status

status: in_progress
task: 轻量化预算和导出策略

protocol/budget.ts now validates explicit integer budgets for triangles, vertices, index bytes, material slots, texture bytes and estimated GPU bytes. evaluateLightweightBudget returns every violation with limit, actual value and excess while leaving the measured usage unchanged. Browser E2E covers a mixed triangle/GPU over-budget report.

aggregateLightweightUsage and evaluateLightweightBudgets now produce deterministic project, collection, object and LOD scopes. Project usage sums each source object once; collection membership is reported per collection and LOD usage is kept separate so generated levels are not double-counted. Browser E2E covers all four scope reports.

analyzeGLBExport now runs before the UI export action and returns structured warnings/errors for summary-only or missing geometry, unevaluated modifiers, external/packed images, linked material inputs and unavailable skin remapping. When no blocking condition is present, the local exporter writes a standards- shaped GLB 2.0 binary containing hierarchy, mesh positions/normals/UVs/colors, material groups, PBR material factors and shape-key morph targets. Blender shape-key positions are converted to glTF deltas in the Z-up to Three.js/glTF basis conversion. The top-bar action downloads this local binary; browser E2E checks the GLB header and a non-zero morph delta.

exportGLB now accepts caller-provided local asset buffers, embeds each image as a GLB buffer view, and connects it to exported PBR materials. It exports JOINTS_0/WEIGHTS_0, bone nodes, inverse bind matrices and supported object or bone animation channels for a resolved armature binding. The local test worker parses the emitted GLB JSON again; browser E2E embeds a real local PNG and verifies its byte length/signature, skin joints, MAT4 inverse-bind accessor, animation channels and skin attributes without a network fetch.

The native reader now extracts the exact bytes of both legacy and list-based Blender packed images through the local asset request ABI; the packed fixture checks PNG signature, MIME and byte length without a network request. The GLB worker strictly parses the emitted JSON/BIN chunks and compares mesh attributes, embedded image byte counts/MIME, skin joints/inverse-bind MAT4s, morph targets and grouped animation paths against the source SceneIR. The browser round-trip test has no semantic mismatches. Blender-side unsupported features remain explicit export warnings.