perf(scene): zoom-adaptive curve tolerance for top-level wires (Phase 3.2)
Edge tessellation used a fixed 0.005 world-unit chord-height tolerance regardless of zoom — a 1000 m radius arc viewed at 50 mm/px still emitted hundreds of segments that all collapsed onto the same screen pixel. `truck_tess` now reads tolerance from a process-wide AtomicU64 override. `Scene::wires_for_block` sets the override to ~0.5 px chord height (world_per_pixel × 0.5) before the par_iter, then a Drop guard clears it back to the default. Floor stays at the original CURVE_TOL so extreme zoom-in keeps full quality. Block-cache rebuilds and off-render paths (snap, hit-test) always see the default — the override is bracketed to the render call only. Roadmap entry for Phase 3.2 removed; Implementation Order / Key Files tables updated. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0584e3c862
commit
26271b8c63
3 changed files with 50 additions and 29 deletions
|
|
@ -1051,6 +1051,21 @@ impl Scene {
|
|||
let blk_ref: &block_cache::BlockCache = &blk_cache;
|
||||
let view_aabb = self.view_world_aabb();
|
||||
let wpp = self.world_per_pixel();
|
||||
// Zoom-adaptive curve sampling for top-level Edge tessellation. Target
|
||||
// ~0.5 px chord height — far-out arcs that used to emit hundreds of
|
||||
// segments now collapse to a handful. The guard clears the override
|
||||
// when this scope exits so off-render tessellation (snap previews,
|
||||
// hit-test, block_cache rebuild) sees the default.
|
||||
struct CurveTolGuard;
|
||||
impl Drop for CurveTolGuard {
|
||||
fn drop(&mut self) {
|
||||
crate::scene::truck_tess::set_curve_tol_override(None);
|
||||
}
|
||||
}
|
||||
let _tol_guard = wpp.map(|w| {
|
||||
crate::scene::truck_tess::set_curve_tol_override(Some((w * 0.5) as f64));
|
||||
CurveTolGuard
|
||||
});
|
||||
let mut wires: Vec<WireModel> = visible
|
||||
.into_par_iter()
|
||||
.flat_map(|e| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue