Skip to content

Vulkan: feature-edge-only overlay + empty auto-clip bbox refresh - #70

Merged
brianmk merged 2 commits into
coin-Integratefrom
fix/vulkan-grid-clip-edge-overlay
Sep 29, 2026
Merged

brianmk merged 2 commits into
coin-Integratefrom
fix/vulkan-grid-clip-edge-overlay

Conversation

@brianmk

@brianmk brianmk commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Two Vulkan renderer fixes surfaced by the Draft working-plane grid (the "ground plane" in the FreeCAD fork).

1. Restrict the edge overlay to real B-Rep feature edges

buildWorkItems() re-drew every SO_TOPOLOGY_LINES/LINE_STRIP command with the uniform VulkanWireframe edge color. That recolored arbitrary line geometry, so the Draft grid's two colored axes both rendered in the overlay color (both red) instead of red/green.

  • SoShape::isFeatureEdgeSet() (default false) is folded into SoRenderCommand::isFeatureEdge by soshape_emit_ir_commands().
  • FreeCAD's SoBrepEdgeSet overrides it true.
  • The edge overlay now re-draws only commands with the flag; the grid, dimensions and other annotation line sets stay in the normal pass with their own per-part colors.

2. Refresh an empty auto-clip bbox on a scene change

setClippingPlanes() keys its bbox cache on computeSceneFingerprint(), which hashes the retained draw list. That lagged the live graph by one frame, so a pure SoSwitch::whichChild visibility toggle left the fingerprint unchanged and reused a stale box.

On an empty document that stale box is the empty-box default (near=1/far=10), which clips trackers added at the origin: the Draft grid's z=0 plane sat exactly on the near plane at the default camera (pos z=1) and stayed invisible until a camera move refreshed the box. Forcing the bbox walk when the scene is dirty and the cached box is empty puts the grid inside the frustum as soon as it is enabled; scoping to the empty case avoids re-running the O(scene) walk on every selection/hover field write.

Verified with FC_VULKAN_CLIP_DEBUG=1: right after the toggle, with no camera move, the clip box goes from empty (near=1/far=10) to boxz=[-1,-1] near=0/far=2, i.e. the grid is inside the frustum.

The VulkanWireframe edge overlay re-drew every line-topology command with
its uniform edge color, so it recolored arbitrary line geometry -- most
visibly the Draft working-plane grid, whose two colored axes both came out
the overlay color instead of red/green.

Mark feature edges in the IR: SoShape::isFeatureEdgeSet() (default false)
is folded into SoRenderCommand::isFeatureEdge by soshape_emit_ir_commands(),
and FreeCAD's SoBrepEdgeSet overrides it true. buildWorkItems() then only
re-draws commands with that flag, leaving the grid, dimensions and other
annotation line sets to the normal pass with their own per-part colors.
setClippingPlanes() keys its bbox cache on computeSceneFingerprint(), which
hashes the retained draw list -- that lags the live graph by one frame
because setClippingPlanes() runs before the traversal re-records it.  A pure
visibility toggle (SoSwitch::whichChild) therefore left the fingerprint
unchanged and reused a stale box.

On an empty scene that stale box is the empty-box default (near=1/far=10),
which clips GUI trackers added at the origin: the Draft working-plane grid's
z=0 plane sits exactly on the near plane at the default camera (pos z=1) and
stayed invisible until a camera move happened to refresh the box.  Force the
bbox walk when the scene is dirty and the cached box is empty, so the grid
is inside the frustum as soon as it is enabled; scoping to the empty case
avoids re-running the O(scene) walk on every selection/hover field write.
@brianmk
brianmk merged commit c29b2d8 into coin-Integrate Sep 29, 2026
7 checks passed
brianmk added a commit that referenced this pull request Sep 29, 2026
Re-apply the two fixes merged on the fork's coin-Integrate (#70) so adopting
the stack port does not regress the Draft working-plane grid:

- Feature edges are marked in the IR (SoShape::isFeatureEdgeSet() folded into
  SoRenderCommand::isFeatureEdge); the Vulkan edge overlay re-draws only those,
  so the grid keeps its own per-part red/green axes instead of the uniform
  overlay color.
- The empty auto-clip bbox is refreshed on a scene change, so the grid's z=0
  plane is not clipped on a fresh/empty document before a camera move.

coin-vulkan-tests: 28/28 pass (the tess-overlay test marks its synthetic
feature line with isFeatureEdge).
brianmk added a commit that referenced this pull request Sep 29, 2026
coin-Integrate now carries the Draft-grid fixes (#70). The port re-applies
them on the stack tree (previous commit), so this merge keeps the port tree
and records the integration branch as an ancestor for a conflict-free PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant