Added possibility to change hole height and taper

The parameters are yet not saved in ModelObject and they are common for all holes
This commit is contained in:
Lukas Matena 2019-11-05 10:16:10 +01:00
parent 04bcdff110
commit 3fe160e60a
2 changed files with 26 additions and 15 deletions

View File

@ -270,6 +270,7 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) cons
render_color[0] = point_selected ? 1.0f : 0.7f;
render_color[1] = point_selected ? 0.3f : 0.7f;
render_color[2] = point_selected ? 0.3f : 0.7f;
render_color[3] = 0.5f;
}
}
glsafe(::glColor4fv(render_color));
@ -296,16 +297,20 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) cons
Eigen::AngleAxisd aa(q);
glsafe(::glRotated(aa.angle() * (180. / M_PI), aa.axis()(0), aa.axis()(1), aa.axis()(2)));
const double cone_radius = 0.25; // mm
const double cone_height = 0.75;
const double cone_radius = double(support_point.head_front_radius) * RenderPointScale; //0.25; // mm
const double cone_height = m_new_cone_height;
//const double cone_rad_diff = m_new_cone_angle*(cone_radius/(cone_height/2.))*(cone_height/2.);
const double cone_rad_diff = m_new_cone_angle*cone_radius;
glsafe(::glPushMatrix());
glsafe(::glTranslatef(0.f, 0.f, support_point.head_front_radius * RenderPointScale));
::gluCylinder(m_quadric, 0., cone_radius, cone_height, 24, 1);
glsafe(::glTranslatef(0.f, 0.f, -cone_height/2.));
//::gluCylinder(m_quadric, cone_radius, cone_radius, cone_height, 24, 1);
::gluCylinder(m_quadric, cone_radius+cone_rad_diff, cone_radius-cone_rad_diff, cone_height, 24, 1);
glsafe(::glTranslatef(0.f, 0.f, cone_height));
::gluDisk(m_quadric, 0.0, cone_radius, 24, 1);
//::gluDisk(m_quadric, 0.0, cone_radius, 24, 1);
::gluDisk(m_quadric, 0.0, cone_radius-cone_rad_diff, 24, 1);
glsafe(::glPopMatrix());
}
::gluSphere(m_quadric, (double)support_point.head_front_radius * RenderPointScale, 24, 12);
//::gluSphere(m_quadric, (double)support_point.head_front_radius * RenderPointScale, 24, 12);
if (vol->is_left_handed())
glFrontFace(GL_CCW);
@ -686,6 +691,10 @@ RENDER_AGAIN:
m_old_point_head_diameter = 0.f;
}
// !!!! Something as above should be done for the cone angle
ImGui::SliderFloat(" ", &m_new_cone_angle, -1.f, 1.f, "%.1f");
ImGui::SliderFloat(" ", &m_new_cone_height, 0.1f, 10.f, "%.1f");
m_imgui->disabled_begin(m_selection_empty);
remove_selected = m_imgui->button(m_desc.at("remove_selected"));
m_imgui->disabled_end();

View File

@ -95,6 +95,8 @@ private:
bool m_editing_mode = true; // Is editing mode active?
bool m_old_editing_state = false; // To keep track of whether the user toggled between the modes (needed for imgui refreshes).
float m_new_point_head_diameter; // Size of a new point.
float m_new_cone_angle = 0.f;
float m_new_cone_height = 5.f;
CacheEntry m_point_before_drag; // undo/redo - so we know what state was edited
float m_old_point_head_diameter = 0.; // the same
float m_minimal_point_distance_stash = 0.f; // and again