Fix preview shell rendering

This commit is contained in:
Noisyfox 2023-10-26 16:28:10 +08:00
parent 03daf61862
commit 8f49be40b7

View file

@ -1236,15 +1236,12 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
m_statistics.total_instances_gpu_size = 0;
#endif // ENABLE_GCODE_VIEWER_STATISTICS
render_shells();
// Orca: add shell overlay effect
glsafe(::glClear(GL_DEPTH_BUFFER_BIT));
if (m_roles.empty())
return;
glsafe(::glEnable(GL_DEPTH_TEST));
glsafe(::glEnable(GL_DEPTH_TEST));
render_toolpaths();
render_shells();
float legend_height = 0.0f;
render_legend(legend_height, canvas_width, canvas_height, right_margin);
@ -4115,16 +4112,16 @@ void GCodeViewer::render_shells()
if (shader == nullptr)
return;
glsafe(::glEnable(GL_DEPTH_TEST));
// glsafe(::glDepthMask(GL_FALSE));
shader->start_using();
shader->set_uniform("emission_factor", 0.1f);
const Camera& camera = wxGetApp().plater()->get_camera();
//BBS: reopen cul faces
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, false, camera.get_view_matrix(), camera.get_projection_matrix());
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, true, camera.get_view_matrix(), camera.get_projection_matrix());
shader->set_uniform("emission_factor", 0.0f);
shader->stop_using();
// glsafe(::glDepthMask(GL_TRUE));
// glsafe(::glDepthMask(GL_TRUE));
}
//BBS