Follow-up of afcac6e2ea - Fixed GLGizmoSlaSupports::render_points()

This commit is contained in:
enricoturri1966 2022-02-11 11:29:00 +01:00
parent c9ff260d13
commit 0c74081f7d

View File

@ -127,6 +127,14 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
if (! has_points && ! has_holes) if (! has_points && ! has_holes)
return; return;
#if ENABLE_GLBEGIN_GLEND_REMOVAL
GLShaderProgram* shader = wxGetApp().get_shader(picking ? "flat" : "gouraud_light");
if (shader == nullptr)
return;
shader->start_using();
ScopeGuard guard([shader]() { shader->stop_using(); });
#else
GLShaderProgram* shader = picking ? nullptr : wxGetApp().get_shader("gouraud_light"); GLShaderProgram* shader = picking ? nullptr : wxGetApp().get_shader("gouraud_light");
if (shader != nullptr) if (shader != nullptr)
shader->start_using(); shader->start_using();
@ -134,6 +142,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
if (shader != nullptr) if (shader != nullptr)
shader->stop_using(); shader->stop_using();
}); });
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL
const GLVolume* vol = selection.get_volume(*selection.get_volume_idxs().begin()); const GLVolume* vol = selection.get_volume(*selection.get_volume_idxs().begin());
const Transform3d& instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse(); const Transform3d& instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse();
@ -177,11 +186,12 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
#if ENABLE_GLBEGIN_GLEND_REMOVAL #if ENABLE_GLBEGIN_GLEND_REMOVAL
m_cone.set_color(render_color); m_cone.set_color(render_color);
m_sphere.set_color(render_color); m_sphere.set_color(render_color);
if (!picking)
#else #else
m_cone.set_color(-1, render_color); m_cone.set_color(-1, render_color);
m_sphere.set_color(-1, render_color); m_sphere.set_color(-1, render_color);
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL
if (shader && !picking) if (shader && !picking)
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL
shader->set_uniform("emission_factor", 0.5f); shader->set_uniform("emission_factor", 0.5f);
// Inverse matrix of the instance scaling is applied so that the mark does not scale with the object. // Inverse matrix of the instance scaling is applied so that the mark does not scale with the object.
@ -236,9 +246,9 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
m_cylinder.set_color(render_color); m_cylinder.set_color(render_color);
#else #else
m_cylinder.set_color(-1, render_color); m_cylinder.set_color(-1, render_color);
if (shader != nu)
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL #endif // ENABLE_GLBEGIN_GLEND_REMOVAL
if (shader) shader->set_uniform("emission_factor", 0.5f);
shader->set_uniform("emission_factor", 0.5f);
for (const sla::DrainHole& drain_hole : m_c->selection_info()->model_object()->sla_drain_holes) { for (const sla::DrainHole& drain_hole : m_c->selection_info()->model_object()->sla_drain_holes) {
if (is_mesh_point_clipped(drain_hole.pos.cast<double>())) if (is_mesh_point_clipped(drain_hole.pos.cast<double>()))
continue; continue;