perf(scene): pixel-size LOD cull at zoom-out

Frustum culling only helps at zoom-in (offscreen geometry); zoom-out
still tessellated and uploaded every wire even when an entire entity
projected to a single pixel. Now we also drop wires whose world AABB
projects smaller than 0.5px in the active view — a fit-all view of a
city plan skips sub-pixel symbols, lines, and curves before they ever
hit the GPU.

  - `Scene` captures `world_per_pixel` each render from camera ortho_size
    / widget height.
  - `expand_insert` / `tessellate_entity` take an optional
    `world_per_pixel`; per-LocalWire / per-nested / whole-Insert /
    top-level entity AABB → pixel-size test → skip if < MIN_PIXEL_SIZE.
  - One-off paths (hit-test, viewport pane) pass `None` so they still
    see full geometry regardless of zoom.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hakan 2026-05-14 14:22:39 +03:00
commit c5ed83c752
3 changed files with 133 additions and 36 deletions

View file

@ -321,6 +321,7 @@ impl Scene {
// a correct culling rectangle before entity_wires_arc() runs.
if bounds.height > 0.0 {
self.set_render_aspect(bounds.width / bounds.height);
self.set_render_pixel_scale(bounds.width, bounds.height);
}
let entity_arc = self.entity_wires_arc();