Fixed rendering of printbed while the camera is below it

This commit is contained in:
enricoturri1966 2022-04-11 08:38:09 +02:00
parent 43d306260f
commit bea50dce7c
6 changed files with 137 additions and 26 deletions

View file

@ -1692,6 +1692,9 @@ void GLCanvas3D::render()
#if ENABLE_RENDER_PICKING_PASS
if (!m_picking_enabled || !m_show_picking_texture) {
#endif // ENABLE_RENDER_PICKING_PASS
const bool is_looking_downward = camera.is_looking_downward();
// draw scene
glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
_render_background();
@ -1701,10 +1704,11 @@ void GLCanvas3D::render()
_render_gcode();
_render_sla_slices();
_render_selection();
if (is_looking_downward)
#if ENABLE_GL_SHADERS_ATTRIBUTES
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), !camera.is_looking_downward(), true);
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), false, true);
#else
_render_bed(!camera.is_looking_downward(), true);
_render_bed(false, true);
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
_render_objects(GLVolumeCollection::ERenderType::Transparent);
@ -1727,6 +1731,12 @@ void GLCanvas3D::render()
// could be invalidated by the following gizmo render methods
_render_selection_sidebar_hints();
_render_current_gizmo();
if (!is_looking_downward)
#if ENABLE_GL_SHADERS_ATTRIBUTES
_render_bed(camera.get_view_matrix(), camera.get_projection_matrix(), true, true);
#else
_render_bed(true, true);
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
#if ENABLE_RENDER_PICKING_PASS
}
#endif // ENABLE_RENDER_PICKING_PASS