forked from 1b-agent/opencadstudio-upstream
fix(viewport): per-tile wire cache for Model layout
Tiled Model panes were all reading from the shared `entity_wires_arc`, whose tessellation runs `view_world_aabb` / `world_per_pixel` against the live `Scene::camera`. Zooming the active tile re-built that arc with the active camera's LOD / frustum cull, then every other tile rendered from the same arc — content in the inactive panes flickered between full and LOD-stub tessellations as you zoomed. - `wires_for_block` now delegates to `wires_for_block_culled`, which takes `view_aabb` + `wpp` explicitly. The original caller passes the live-camera values; tile rendering passes its own. - New `model_tile_wires_arc` builds a per-tile view AABB + wpp from the tile's camera + pixel rect and caches the result. Cache is keyed by tile index; the value holds `(geometry_epoch, camera_state_hash)`, so a stale hit (camera moved, doc changed) still misses and rebuilds. - `ViewportInstance` gains `tile_idx` so `viewport_data_for` can route Model tiles into the per-tile cache without disturbing the paper- layout content-viewport path (it still uses `model_wires_for_viewport_arc`).
This commit is contained in:
1 parent
168f248593
commit
0eaac008dd
2 files changed
+119
-4
No files matched your search
+12
-1
@@ -580,7 +580,18 @@ impl Scene {
|
||||
let us = (visible_w / full.width).clamp(0.0, 1.0);
|
||||
let vs = (visible_h / full.height).clamp(0.0, 1.0);
|
||||
|
||||
let base_arc = if inst.handle == acadrust::Handle::NULL {
|
||||
// Model tiles each get their own tessellation cache keyed off the
|
||||
// tile's camera — culling/LOD depend on per-tile zoom, not the
|
||||
// active tile's. Paper-space content viewports already had a
|
||||
// per-viewport cache.
|
||||
let base_arc = if let Some(tile_idx) = inst.tile_idx {
|
||||
let aspect = if full.height > 0.0 {
|
||||
full.width / full.height
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
self.model_tile_wires_arc(tile_idx, &inst.camera, aspect, full.height)
|
||||
} else if inst.handle == acadrust::Handle::NULL {
|
||||
self.entity_wires_arc()
|
||||
} else {
|
||||
self.model_wires_for_viewport_arc(inst.handle)
|
||||
|
||||
Reference in new issue
Block a user