mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 18:44:47 +00:00
ifcviewer: fix pick-pass cull corruption and cached-model ID collisions
Two stability bugs: 1. Clicking an object left the scene with wrong shading until the camera moved. The pick pass re-culls every model with its own parameters (min_pixel_radius=0, no HiZ) and overwrites each model's visible_ssbo and indirect buffer. The next render() saw an unchanged camera, skipped the cull via the have_cached_cull_ shortcut, and drew the stale pick-pass buffers. Fix: invalidate have_cached_cull_ at the end of pickObjectAt(). 2. Loading two sidecar-cached models made the second model's picked properties resolve to the first model's elements. Sidecars store raw object_id / model_id values from the session that wrote them, and both files start at object_id=1, so element_map_ entries collided. Fix: on load, rebase every PackedElementInfo and InstanceCpu by (next_object_id_ - min_id_in_sidecar) and overwrite model_id with the freshly-assigned handle before the elements hit element_map_. Also document both in the README — the pick-pass note under 3A contribution culling, the sidecar rebase under the sidecar format section.
This commit is contained in:
@@ -1282,6 +1282,13 @@ uint32_t ViewportWindow::pickObjectAt(int x, int y) {
|
||||
|
||||
renderPickPass();
|
||||
|
||||
// The pick pass overwrote each model's visible_ssbo / indirect_buffer with
|
||||
// pick-specific cull params (no contribution cull, no HiZ). Invalidate
|
||||
// the cached cull so the next render() rebuilds them with main-render
|
||||
// params; otherwise the viewport draws with stale pick-pass buffers and
|
||||
// shading looks wrong until the camera moves.
|
||||
have_cached_cull_ = false;
|
||||
|
||||
int px = x * devicePixelRatio();
|
||||
int py = (height() - y) * devicePixelRatio();
|
||||
uint32_t pixel = 0;
|
||||
|
||||
Reference in New Issue
Block a user