fix: GLB tessellation destroyed by BRepBuilderAPI_Transform + MergeFaces

Root cause 1: BRepBuilderAPI_Transform(shape, trsf, copy=True) destroys
all Poly_Triangulation data. The mm→m scaling was applied before export,
wiping the tessellation from BRepMesh_IncrementalMesh.

Fix: Remove BRepBuilderAPI_Transform entirely — RWGltf_CafWriter already
handles mm→m conversion and Z-up→Y-up rotation internally.

Root cause 2: RWGltf_CafWriter with MergeFaces=False (the default) fails
to find per-face tessellation from the XCAF component hierarchy, producing
degenerate meshes (~2 vertices per face instead of thousands).

Fix: SetMergeFaces(True) to compose face triangulations into proper
per-shape mesh buffers. Vertex count goes from 1,212 to 46,573.

Also bumps cache key version to v2 to invalidate broken cached GLBs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 16:23:41 +01:00
parent 7054fa4b40
commit 0020376702
2 changed files with 70 additions and 38 deletions
@@ -95,8 +95,9 @@ def generate_gltf_geometry_task(self, cad_file_id: str):
_cache_hit_asset_id = None
# Composite cache key includes deflection settings so changing them invalidates cache
# v2: tessellation now happens after mm→m scaling (fixes destroyed tessellation)
effective_cache_key = (
f"{_current_hash}:{linear_deflection}:{angular_deflection}:{tessellation_engine}"
f"v2:{_current_hash}:{linear_deflection}:{angular_deflection}:{tessellation_engine}"
if _current_hash else None
)