Fix z-fighting between feature previews and the bodies in the Design tab

The bodies now always draw over the preview on every face a feature leaves unchanged, for
all features. Since a hole's cut sits inside the body, the Hole preview now hides the
bodies and shows the result alone, as Fillet/Chamfer and Draft do.
This commit is contained in:
SoftFever
2026-10-05 19:38:46 +08:00
parent 6dfd1c2a0a
commit b67269ccc4
5 changed files with 32 additions and 6 deletions
+7 -3
View File
@@ -378,10 +378,14 @@ void DesignCanvas::reload(bool keep_view)
v->set_color(c);
}
} else if (obj_idx == 1) {
// The ghost is normally a faint blue overlay on the visible body. In preview-only
// mode it IS the result (base bodies hidden), so render it opaque so it reads as a
// finished solid rather than a see-through hint.
// The ghost is the whole resulting model, normally drawn as a faint blue overlay on
// the visible bodies. Every face the feature leaves alone is in both, at the same
// depth, so the ghost is drawn with a depth bias: the bodies win on those faces instead
// of the two copies z-fighting, and the ghost shows only where the result reaches past
// the bodies. In preview-only mode it IS the result (base bodies hidden), so render it
// opaque so it reads as a finished solid rather than a see-through hint.
v->set_color(m_body_hidden ? ColorRGBA(0.40f, 0.82f, 1.0f, 1.0f) : ghost);
v->depth_bias = true;
}
}