Tech ENABLE_LEGACY_OPENGL_REMOVAL - porting remaining changes

(cherry picked from commit prusa3d/PrusaSlicer@2f572d3cf0 )
This commit is contained in:
enricoturri1966
2023-10-25 23:14:53 +08:00
committed by Noisyfox
parent 9f4713eee8
commit 71fd4084c2
68 changed files with 2145 additions and 1837 deletions

View File

@@ -98,7 +98,7 @@ bool GLGizmoSeam::on_key_down_select_tool_type(int keyCode) {
void GLGizmoSeam::render_triangles(const Selection& selection) const
{
ClippingPlaneDataWrapper clp_data = this->get_clipping_plane_data();
auto* shader = wxGetApp().get_shader("mm_gouraud");
auto* shader = wxGetApp().get_shader("mm_gouraud_attr");
if (!shader)
return;
shader->start_using();
@@ -120,8 +120,11 @@ void GLGizmoSeam::render_triangles(const Selection& selection) const
if (is_left_handed)
glsafe(::glFrontFace(GL_CW));
glsafe(::glPushMatrix());
glsafe(::glMultMatrixd(trafo_matrix.data()));
const Camera& camera = wxGetApp().plater()->get_camera();
const Transform3d matrix = camera.get_view_matrix() * trafo_matrix;
shader->set_uniform("view_model_matrix", matrix);
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
shader->set_uniform("normal_matrix", (Matrix3d)matrix.matrix().block(0, 0, 3, 3).inverse().transpose());
float normal_z = -::cos(Geometry::deg2rad(m_highlight_by_angle_threshold_deg));
Matrix3f normal_matrix = static_cast<Matrix3f>(trafo_matrix.matrix().block(0, 0, 3, 3).inverse().transpose().cast<float>());
@@ -129,11 +132,10 @@ void GLGizmoSeam::render_triangles(const Selection& selection) const
shader->set_uniform("volume_world_matrix", trafo_matrix);
shader->set_uniform("volume_mirrored", is_left_handed);
shader->set_uniform("slope.actived", m_parent.is_using_slope());
shader->set_uniform("slope.volume_world_normal_matrix", static_cast<Matrix3f>(trafo_matrix.matrix().block(0, 0, 3, 3).inverse().transpose().cast<float>()));
shader->set_uniform("slope.volume_world_normal_matrix", normal_matrix);
shader->set_uniform("slope.normal_z", normal_z);
m_triangle_selectors[mesh_id]->render(m_imgui);
m_triangle_selectors[mesh_id]->render(m_imgui, trafo_matrix);
glsafe(::glPopMatrix());
if (is_left_handed)
glsafe(::glFrontFace(GL_CCW));
}