Merge branch 'dev_native' of github.com:prusa3d/Slic3r into dev_native

This commit is contained in:
tamasmeszaros 2018-11-15 10:47:36 +01:00
commit 08511bfe8b
2 changed files with 15 additions and 4 deletions

View file

@ -56,10 +56,19 @@ void GLGizmoBase::Grabber::render(bool hover, float size) const
render(size, render_color, true);
}
float GLGizmoBase::Grabber::get_half_size(float size) const
{
return std::max(size * SizeFactor, MinHalfSize);
}
float GLGizmoBase::Grabber::get_dragging_half_size(float size) const
{
return std::max(size * SizeFactor * DraggingScaleFactor, MinHalfSize);
}
void GLGizmoBase::Grabber::render(float size, const float* render_color, bool use_lighting) const
{
float half_size = dragging ? size * SizeFactor * DraggingScaleFactor : size * SizeFactor;
half_size = std::max(half_size, MinHalfSize);
float half_size = dragging ? get_dragging_half_size(size) : get_half_size(size);
if (use_lighting)
::glEnable(GL_LIGHTING);
@ -73,7 +82,6 @@ void GLGizmoBase::Grabber::render(float size, const float* render_color, bool us
::glRotated(Geometry::rad2deg(angles(1)), 0.0, 1.0, 0.0);
::glRotated(Geometry::rad2deg(angles(0)), 1.0, 0.0, 0.0);
// face min x
::glPushMatrix();
::glTranslatef(-(GLfloat)half_size, 0.0f, 0.0f);
@ -494,7 +502,7 @@ void GLGizmoRotate::render_angle() const
void GLGizmoRotate::render_grabber(const BoundingBoxf3& box) const
{
double grabber_radius = (double)m_radius * (1.0 + (double)GrabberOffset) + 2.0 * (double)m_axis * box.max_size() * (double)Grabber::SizeFactor;
double grabber_radius = (double)m_radius * (1.0 + (double)GrabberOffset) + 2.0 * (double)m_axis * (double)m_grabbers[0].get_half_size((float)box.max_size());
m_grabbers[0].center = Vec3d(::cos(m_angle) * grabber_radius, ::sin(m_angle) * grabber_radius, 0.0);
m_grabbers[0].angles(2) = m_angle;

View file

@ -38,6 +38,9 @@ protected:
void render(bool hover, float size) const;
void render_for_picking(float size) const { render(size, color, false); }
float get_half_size(float size) const;
float get_dragging_half_size(float size) const;
private:
void render(float size, const float* render_color, bool use_lighting) const;
void render_face(float half_size) const;