Cut: Fixed visualization of the selected connectors which are conflict

+ Back port a Lukas's code for enable/disable current contour
This commit is contained in:
YuSanka 2022-12-01 16:44:21 +01:00
parent f7c832ddaf
commit e07843e6fb
2 changed files with 26 additions and 11 deletions

View file

@ -24,7 +24,7 @@ namespace GUI {
void MeshClipper::set_behaviour(bool fill_cut, double contour_width)
{
if (fill_cut != m_fill_cut || contour_width != m_contour_width)
if (fill_cut != m_fill_cut || is_approx(contour_width, m_contour_width))
m_result.reset();
m_fill_cut = fill_cut;
m_contour_width = contour_width;
@ -97,7 +97,7 @@ void MeshClipper::render_cut()
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
for (CutIsland& isl : m_result->cut_islands) {
isl.model.set_color(isl.disabled ? ColorRGBA(1.f, 0.f, 0.f, 1.f) : color);
isl.model.set_color(isl.disabled ? ColorRGBA(0.5f, 0.5f, 0.5f, 1.f) : color);
isl.model.render();
}
shader->stop_using();
@ -132,7 +132,7 @@ void MeshClipper::render_contour()
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
for (CutIsland& isl : m_result->cut_islands) {
isl.model_expanded.set_color(color);
isl.model_expanded.set_color(isl.disabled ? ColorRGBA(1.f, 0.f, 0.f, 1.f) : color);
isl.model_expanded.render();
}
shader->stop_using();
@ -155,7 +155,7 @@ bool MeshClipper::is_projection_inside_cut(const Vec3d& point_in) const
for (const CutIsland& isl : m_result->cut_islands) {
if (isl.expoly_bb.contains(pt_2d) && isl.expoly.contains(pt_2d))
return true;
return !isl.disabled;
}
return false;
}