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

2.1 KiB

W-074 Status

status: in_progress
task: 编译并复用 Blender Decimate 实现

web_engine_decimate.cpp now wraps Blender's native BMesh decimate entry points (BM_mesh_decimate_collapse, BM_mesh_decimate_unsubdivide and BM_mesh_decimate_dissolve) behind the local web_engine_decimate_apply two-pass C ABI. The wrapper accepts triangle buffers, returns required output capacities on the first call, and leaves the input mesh untouched.

web_engine_apply_command now accepts decimateMesh with a versioned SimplifyProfile, validates the source revision, calls the native wrapper, and replaces the evaluated SceneIR mesh topology. The command allocates output from the input upper bounds and evaluates Decimate once; it does not run the modifier twice merely to query exact capacities. Normals are recomputed from the result, BMFace material indices are retained, and UV/float-color corners are transferred by the W-076 policy layer. Collapse now accepts boundary and non-manifold triangle meshes through the same BMesh bridge. The blend reader reconstructs corner vertices from .corner_edge and .edge_verts only after validating every face cycle, so it never treats edge indices as vertex indices. npm run test:topology-collapse independently opens and collapses an open quad, an open n-gon and a three-face shared-edge mesh; malformed cycles remain summary-only.

The WebEngine CMake target exports the ABI symbol and links a small archive-file group containing Blender BMesh, CustomData-capable BKernel objects, DNA/BLO, local zlib/zstd and allocator support; this avoids pulling the desktop editor/image dependency graph into the WASM module.

The local artifact is installed in both web/app/public/vendor/blender/ and web/app/src/vendor/blender/, with the manifest SHA-256 updated. The native smoke covers all three modes, Collapse topology reduction, revision sequencing, SceneDelta and normal/UV/material attribute lengths. The browser regression suite covers the same local WASM command path, including native command, preview and isolated LOD workers. Modifier-stack transactions and full skin/seam/sharp preservation remain W-075/W-076.