This commit is contained in:
Filip Sykala - NTB T15p 2023-01-31 15:04:39 +01:00
commit 552b1a9cb8
3 changed files with 16 additions and 8 deletions

View File

@ -272,10 +272,6 @@ void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
#else #else
const Transform3d complete_scaling_matrix_inverse = Geometry::Transformation(trafo).get_matrix(true, true, false, true).inverse(); const Transform3d complete_scaling_matrix_inverse = Geometry::Transformation(trafo).get_matrix(true, true, false, true).inverse();
#endif // ENABLE_WORLD_COORDINATE #endif // ENABLE_WORLD_COORDINATE
const bool is_left_handed = Geometry::Transformation(trafo).is_left_handed();
if (is_left_handed)
glsafe(::glFrontFace(GL_CW));
ColorRGBA render_color = { 0.0f, 0.0f, 0.0f, 0.25f }; ColorRGBA render_color = { 0.0f, 0.0f, 0.0f, 0.25f };
if (m_button_down == Button::Left) if (m_button_down == Button::Left)
@ -293,14 +289,18 @@ void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
shader->set_uniform("view_model_matrix", view_model_matrix); shader->set_uniform("view_model_matrix", view_model_matrix);
shader->set_uniform("projection_matrix", camera.get_projection_matrix()); shader->set_uniform("projection_matrix", camera.get_projection_matrix());
const bool is_left_handed = Geometry::Transformation(view_model_matrix).is_left_handed();
if (is_left_handed)
glsafe(::glFrontFace(GL_CW));
assert(s_sphere != nullptr); assert(s_sphere != nullptr);
s_sphere->set_color(render_color); s_sphere->set_color(render_color);
s_sphere->render(); s_sphere->render();
shader->stop_using();
if (is_left_handed) if (is_left_handed)
glsafe(::glFrontFace(GL_CCW)); glsafe(::glFrontFace(GL_CCW));
shader->stop_using();
} }

View File

@ -62,7 +62,11 @@ void GLGizmoSlaBase::update_volumes()
new_volume->set_instance_transformation(po->model_object()->instances[m_parent.get_selection().get_instance_idx()]->get_transformation()); new_volume->set_instance_transformation(po->model_object()->instances[m_parent.get_selection().get_instance_idx()]->get_transformation());
new_volume->set_sla_shift_z(po->get_current_elevation()); new_volume->set_sla_shift_z(po->get_current_elevation());
new_volume->mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(backend_mesh); new_volume->mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(backend_mesh);
m_input_enabled = po->last_completed_step() >= m_min_sla_print_object_step; auto last_comp_step = static_cast<int>(po->last_completed_step());
if (last_comp_step == slaposCount)
last_comp_step = -1;
m_input_enabled = last_comp_step >= m_min_sla_print_object_step;
if (m_input_enabled) if (m_input_enabled)
new_volume->selected = true; // to set the proper color new_volume->selected = true; // to set the proper color
else else

View File

@ -66,7 +66,11 @@ void GLGizmoSlaSupports::data_changed()
m_c->instances_hider()->set_hide_full_scene(true); m_c->instances_hider()->set_hide_full_scene(true);
const SLAPrintObject* po = m_c->selection_info()->print_object(); const SLAPrintObject* po = m_c->selection_info()->print_object();
const int required_step = get_min_sla_print_object_step(); const int required_step = get_min_sla_print_object_step();
if (po != nullptr && po->last_completed_step() < required_step) auto last_comp_step = static_cast<int>(po->last_completed_step());
if (last_comp_step == slaposCount)
last_comp_step = -1;
if (po != nullptr && last_comp_step < required_step)
reslice_until_step((SLAPrintObjectStep)required_step, false); reslice_until_step((SLAPrintObjectStep)required_step, false);
update_volumes(); update_volumes();