Gizmos rotate, move and scale rendered on top of geometry

This commit is contained in:
Enrico Turri 2018-11-14 10:43:52 +01:00
parent 3613a54e03
commit a56cee5f60
3 changed files with 14 additions and 5 deletions

View File

@ -23,6 +23,8 @@
#define ENABLE_MODIFIED_CAMERA_TARGET (1 && ENABLE_1_42_0)
// Add Geometry::Transformation class and use it into ModelInstance, ModelVolume and GLVolume
#define ENABLE_MODELVOLUME_TRANSFORM (1 && ENABLE_1_42_0)
// Gizmos always rendered on top of objects
#define ENABLE_GIZMOS_ON_TOP (1 && ENABLE_1_42_0)
#endif // _technologies_h_

View File

@ -2714,8 +2714,6 @@ void GLCanvas3D::Gizmos::render_current_gizmo(const GLCanvas3D::Selection& selec
if (!m_enabled)
return;
::glDisable(GL_DEPTH_TEST);
_render_current_gizmo(selection);
}
@ -3639,6 +3637,7 @@ void GLCanvas3D::render()
_picking_pass();
// draw scene
::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
_render_background();
if (is_custom_bed) // untextured bed needs to be rendered before objects
@ -3647,8 +3646,8 @@ void GLCanvas3D::render()
// disable depth testing so that axes are not covered by ground
_render_axes(false);
}
_render_objects();
_render_objects();
_render_selection();
if (!is_custom_bed) // textured bed needs to be rendered after objects
@ -4972,8 +4971,6 @@ void GLCanvas3D::_picking_pass() const
void GLCanvas3D::_render_background() const
{
::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
::glPushMatrix();
::glLoadIdentity();
::glMatrixMode(GL_PROJECTION);

View File

@ -631,6 +631,10 @@ void GLGizmoRotate3D::on_stop_dragging()
void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const
{
#if ENABLE_GIZMOS_ON_TOP
::glClear(GL_DEPTH_BUFFER_BIT);
#endif // ENABLE_GIZMOS_ON_TOP
if ((m_hover_id == -1) || (m_hover_id == 0))
m_gizmos[X].render(selection);
@ -749,6 +753,9 @@ void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const
set_tooltip(tooltip);
}
#if ENABLE_GIZMOS_ON_TOP
::glClear(GL_DEPTH_BUFFER_BIT);
#endif // ENABLE_GIZMOS_ON_TOP
::glEnable(GL_DEPTH_TEST);
BoundingBoxf3 box;
@ -1072,6 +1079,9 @@ void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const
else if ((show_position && (m_hover_id == 2)) || m_grabbers[2].dragging)
set_tooltip("Z: " + format(show_position ? position(2) : m_displacement(2), 2));
#if ENABLE_GIZMOS_ON_TOP
::glClear(GL_DEPTH_BUFFER_BIT);
#endif // ENABLE_GIZMOS_ON_TOP
::glEnable(GL_DEPTH_TEST);
const BoundingBoxf3& box = selection.get_bounding_box();