diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2018-09-26 15:37:25 +0300 |
---|---|---|
committer | Lukas Matena <lukasmatena@seznam.cz> | 2018-09-26 15:37:25 +0300 |
commit | ce5c03c894d8f3835a385587391902fbe3849e9b (patch) | |
tree | b5fe3f5f765b2ec34d10d03989230818144a69d5 /xs | |
parent | 10393ba834169a09ec2c06b8c7c2e9f52bba7d30 (diff) |
Refactored previous commit
Diffstat (limited to 'xs')
-rw-r--r-- | xs/src/slic3r/GUI/GLGizmo.cpp | 15 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/GLGizmo.hpp | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/xs/src/slic3r/GUI/GLGizmo.cpp b/xs/src/slic3r/GUI/GLGizmo.cpp index cdd2badef..5aa9472b0 100644 --- a/xs/src/slic3r/GUI/GLGizmo.cpp +++ b/xs/src/slic3r/GUI/GLGizmo.cpp @@ -1615,9 +1615,12 @@ void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const g.color[2] = 0.f; } - render_grabbers(dragged_offset); - render_tooltip_texture(); + ::glPushMatrix(); + ::glTranslatef((GLfloat)dragged_offset(0), (GLfloat)dragged_offset(1), (GLfloat)dragged_offset(2)); + render_grabbers(); + ::glPopMatrix(); + render_tooltip_texture(); ::glDisable(GL_BLEND); } @@ -1629,10 +1632,10 @@ void GLGizmoSlaSupports::on_render_for_picking(const BoundingBoxf3& box) const m_grabbers[i].color[1] = 1.0f; m_grabbers[i].color[2] = picking_color_component(i); } - render_grabbers(Vec3d::Zero(), true); + render_grabbers(true); } -void GLGizmoSlaSupports::render_grabbers(const Vec3d& dragged_offset, bool picking) const +void GLGizmoSlaSupports::render_grabbers(bool picking) const { for (int i = 0; i < (int)m_grabbers.size(); ++i) { @@ -1651,12 +1654,12 @@ void GLGizmoSlaSupports::render_grabbers(const Vec3d& dragged_offset, bool picki ::glEnable(GL_LIGHTING); ::glColor3f((GLfloat)render_color[0], (GLfloat)render_color[1], (GLfloat)render_color[2]); ::glPushMatrix(); - Vec3d center = m_model_object->instances.front()->world_matrix() * m_grabbers[i].center + dragged_offset; + Vec3d center = m_model_object->instances.front()->world_matrix() * m_grabbers[i].center; ::glTranslatef((GLfloat)center(0), (GLfloat)center(1), (GLfloat)center(2)); GLUquadricObj *quadric; quadric = ::gluNewQuadric(); ::gluQuadricDrawStyle(quadric, GLU_FILL ); - ::gluSphere( quadric , 0.5f, 36 , 18 ); + ::gluSphere( quadric , 0.75f, 36 , 18 ); ::gluDeleteQuadric(quadric); ::glPopMatrix(); if (!picking) diff --git a/xs/src/slic3r/GUI/GLGizmo.hpp b/xs/src/slic3r/GUI/GLGizmo.hpp index cdebba99c..b3bc12644 100644 --- a/xs/src/slic3r/GUI/GLGizmo.hpp +++ b/xs/src/slic3r/GUI/GLGizmo.hpp @@ -439,7 +439,7 @@ private: void on_update(const Linef3& mouse_ray, const Point* mouse_pos); void on_render(const BoundingBoxf3& box) const; void on_render_for_picking(const BoundingBoxf3& box) const; - void render_grabbers(const Vec3d& dragged_offset, bool picking = false) const; + void render_grabbers(bool picking = false) const; void render_tooltip_texture() const; bool is_mesh_update_necessary() const; void update_mesh(); |