mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 06:00:51 +00:00
viewport: wire up the backface-culling setting
The "Backface Culling" checkbox persisted a value and reflected it, but nothing consumed AppSettings::backfaceCulling — the opaque pipeline hardcoded cullMode = Back, so toggling had no effect. Build a second opaque pipeline (cullMode None) alongside the culled one and pick between them per-frame from a backface_culling_ flag; setBackfaceCulling flips the flag and requests a redraw (no rebuild). ViewportWindow forwards it, and MainWindow applies the persisted value at startup and re-applies on change — same wiring as the nav preset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,12 @@ public:
|
||||
void setNavPreset(const char* name);
|
||||
const NavBindings& navBindings() const { return nav_bindings_; }
|
||||
|
||||
// Toggle backface culling of opaque geometry. Off draws back faces too
|
||||
// (useful for single-sided IFC meshes). Switches the opaque pipeline at
|
||||
// draw time — no rebuild.
|
||||
void setBackfaceCulling(bool enabled);
|
||||
bool backfaceCulling() const { return backface_culling_; }
|
||||
|
||||
// Frame the current selection: union the selected objects' world AABBs and
|
||||
// fit the camera to them (same 1.30 padding as the desktop "F" hotkey).
|
||||
// No-op with an empty selection or no resolvable AABBs; returns whether it
|
||||
@@ -909,7 +915,9 @@ private:
|
||||
WGPUBindGroupLayout model_bgl_ = nullptr; // group 1
|
||||
WGPUPipelineLayout pipeline_layout_ = nullptr;
|
||||
WGPURenderPipeline main_pipeline_ = nullptr;
|
||||
WGPURenderPipeline main_pipeline_no_cull_ = nullptr; // backface culling off
|
||||
WGPURenderPipeline main_pipeline_transparent_ = nullptr;
|
||||
bool backface_culling_ = true;
|
||||
// Section-plane gizmo, shared by desktop + web (both render via render()).
|
||||
// Lifted out of the Qt-coupled OverlayRenderer so one identical gizmo draws
|
||||
// everywhere; the desktop's OverlayRenderer no longer draws it.
|
||||
|
||||
Reference in New Issue
Block a user