mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 22:43:41 +00:00
ifcviewer: visibility (hide/isolate/show-all) + X-ray — desktop parity on web
Lift the visibility + X-ray ops into ViewportCore so desktop and web share them. The cull already reads visibility_ (hidden objects skipped) and the frame uniform reads xray_alpha_cap_, both per frame, so each op just mutates state + schedules a frame — no GPU buffers to rebuild, no rendering work: - hideSelected (hide the selection, then deselect), isolateSelected (hide every non-selected object in a visible model), showAll (clear the hidden set), toggleXray (flip the alpha cap 1.0<->0.3; cull routes all to the transparent pass), xrayActive(). - Desktop ViewportWindow: the H / Shift+H / Alt+H / Alt+X keys and the menu-action wrappers now call the core; the four inline/duplicated implementations are gone. - Web main_web: same keys (H hide · Shift+H isolate · Alt+H show all · Alt+X x-ray) + toolbar buttons (Hide / Isolate / Show all / X-ray, the last reflecting active state). Verified on web: x-ray toggles and visibly translucent-izes the scene, hide after a pick removes geometry, 0 GPU errors. 113/113 desktop + 6/6 web smoke; desktop app builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -624,6 +624,19 @@ public:
|
||||
// Marks selection_ dirty for the next render's flush.
|
||||
void applyPickToSelection(std::uint32_t object_id, bool add, bool remove);
|
||||
|
||||
// Visibility + X-ray, shared by desktop (H / Shift+H / Alt+H / Alt+X) and
|
||||
// web. Hidden objects are skipped by the cull and xray_alpha_cap_ is read
|
||||
// by the frame uniform, both per frame — so each call just mutates state and
|
||||
// schedules a frame; no GPU buffers to rebuild.
|
||||
void hideSelected(); // hide the selected objects, then clear selection
|
||||
void isolateSelected(); // hide everything that is NOT selected
|
||||
void showAll(); // clear the hidden set
|
||||
size_t hiddenCount() const { return visibility_.hiddenCount(); }
|
||||
// Global X-ray: translucent everything. Flips the frame uniform's alpha cap;
|
||||
// the cull classifier routes every instance through the transparent pass.
|
||||
void toggleXray();
|
||||
bool xrayActive() const { return xray_alpha_cap_ < 1.0f; }
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
// Async object pick for the web build: encodes the same pick pass as
|
||||
// pickObjectAt but reads the staging buffer back via a spontaneous map
|
||||
|
||||
Reference in New Issue
Block a user