Use a 2-pass depth based outline algorithm when selected

This commit is contained in:
Noisyfox 2024-08-18 19:30:40 +08:00
parent 2acd858bf3
commit 13e18d1d65
7 changed files with 262 additions and 46 deletions

View file

@ -1244,7 +1244,7 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
#endif // ENABLE_GCODE_VIEWER_STATISTICS
glsafe(::glEnable(GL_DEPTH_TEST));
render_shells();
render_shells(canvas_width, canvas_height);
if (m_roles.empty())
return;
@ -4023,7 +4023,7 @@ void GCodeViewer::render_toolpaths()
}
}
void GCodeViewer::render_shells()
void GCodeViewer::render_shells(int canvas_width, int canvas_height)
{
//BBS: add shell previewing logic
if ((!m_shells.previewing && !m_shells.visible) || m_shells.volumes.empty())
@ -4039,7 +4039,9 @@ void GCodeViewer::render_shells()
shader->start_using();
shader->set_uniform("emission_factor", 0.1f);
const Camera& camera = wxGetApp().plater()->get_camera();
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, false, camera.get_view_matrix(), camera.get_projection_matrix());
shader->set_uniform("z_far", camera.get_far_z());
shader->set_uniform("z_near", camera.get_near_z());
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, false, camera.get_view_matrix(), camera.get_projection_matrix(), {canvas_width, canvas_height});
shader->set_uniform("emission_factor", 0.0f);
shader->stop_using();