Ports Bonsai's AreaMeasurement onto WgpuViewportWindow as a new
WgpuAreaMeasurement class. Each LMB pick resolves to (instance,
triangle), BFS-expands the coplanar patch (dot(normal, seed_normal)
> 0.9999, ~0.81° tolerance), and toggles it in/out of the running set.
Alt+LMB skips BFS for single-triangle accumulate. Connected-components
sweep over the selected set produces one "X.XXXX m²" label per patch
at its area-weighted centroid in world space; HUD shows the running
total + triangle count.
Dependencies layered in:
- WgpuOverlayRenderer.setHighlightTriangles / encodeHighlightTriangles:
translucent world-space triangle list (cyan @ 0.45 alpha), depth-
tested but depth-write off so the corner gizmo + labels still sit
on top.
- WgpuViewportWindow.pickMeshLocalAt: reuses pickSurfaceAt for the
world hit, then inverts the instance's composed transform to express
it in mesh-local space — what the BFS needs. Uses the live map key
(`mid`) rather than InstanceCpu.model_id, which is whatever the GL
streamer wrote at sidecar-write time and goes stale across sessions.
- WgpuViewportWindow.readbackMeshTriangles: CPU mesh shadow lookup.
The shadow itself is populated during the same dequant pass that
computes mesh-local volume — applyCachedModel for full loads and
applyStreamedChunk for streaming, so the BFS has data the moment
the user can pick it.
WgpuModelGpuData gains a MeshTriangles vector indexed by mesh_id;
doubles per-vertex CPU memory (12 B/vert) but skips wgpu mapAsync
plumbing for now. Bounds-check at pick time gracefully no-ops when a
stale sidecar field is out of range.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>