From f4cf9494d0a0b4e956b86001dcd261c23fea68ee Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 1 Mar 2022 12:00:29 +0100 Subject: [PATCH] Tech ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - Some refactoring --- src/slic3r/GUI/3DBed.cpp | 3 +-- src/slic3r/GUI/GLCanvas3D.cpp | 6 ++---- src/slic3r/GUI/Gizmos/GLGizmoCut.cpp | 3 +-- src/slic3r/GUI/Gizmos/GLGizmoMove.cpp | 6 ++---- src/slic3r/GUI/Gizmos/GLGizmoScale.cpp | 15 +++++---------- src/slic3r/GUI/MeshUtils.cpp | 3 +-- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index b0b6fcd42..0eb5b7bee 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -707,8 +707,7 @@ void Bed3D::render_default(bool bottom, bool picking) shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES glsafe(::glEnable(GL_DEPTH_TEST)); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d880e6ade..1821d36ee 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -983,8 +983,7 @@ void GLCanvas3D::SequentialPrintClearance::render() shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES glsafe(::glEnable(GL_DEPTH_TEST)); @@ -5826,8 +5825,7 @@ void GLCanvas3D::_render_camera_target() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES for (int i = 0; i < 3; ++i) { m_camera_target.axis[i].render(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 099f6110c..3ce8681d7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -145,8 +145,7 @@ void GLGizmoCut::on_render() } #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES m_plane.render(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp index f4729c825..1538fc229 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp @@ -164,8 +164,7 @@ void GLGizmoMove3D::on_render() #endif // ENABLE_GLBEGIN_GLEND_REMOVAL #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES // draw axes @@ -207,8 +206,7 @@ void GLGizmoMove3D::on_render() shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES render_grabber_connection(m_hover_id); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp index 06d0622be..915b76a20 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp @@ -273,8 +273,7 @@ void GLGizmoScale3D::on_render() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES if (m_grabbers[0].enabled && m_grabbers[1].enabled) render_grabbers_connection(0, 1, m_grabbers[0].color); @@ -323,8 +322,7 @@ void GLGizmoScale3D::on_render() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES render_grabbers_connection(0, 1, m_grabbers[0].color); shader->stop_using(); @@ -359,8 +357,7 @@ void GLGizmoScale3D::on_render() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES render_grabbers_connection(2, 3, m_grabbers[2].color); shader->stop_using(); @@ -395,8 +392,7 @@ void GLGizmoScale3D::on_render() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES render_grabbers_connection(4, 5, m_grabbers[4].color); shader->stop_using(); @@ -431,8 +427,7 @@ void GLGizmoScale3D::on_render() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES render_grabbers_connection(6, 7, m_drag_color); render_grabbers_connection(7, 8, m_drag_color); diff --git a/src/slic3r/GUI/MeshUtils.cpp b/src/slic3r/GUI/MeshUtils.cpp index 479d32711..787110ad7 100644 --- a/src/slic3r/GUI/MeshUtils.cpp +++ b/src/slic3r/GUI/MeshUtils.cpp @@ -97,8 +97,7 @@ void MeshClipper::render_cut() if (shader != nullptr) { shader->start_using(); #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); - shader->set_uniform("projection_view_model_matrix", matrix); + shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix()); #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES m_model.set_color(color); m_model.render();