Tech ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - Some refactoring

This commit is contained in:
enricoturri1966 2022-03-01 12:00:29 +01:00
parent 282b3d2d6b
commit f4cf9494d0
6 changed files with 12 additions and 24 deletions

View File

@ -707,8 +707,7 @@ void Bed3D::render_default(bool bottom, bool picking)
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glEnable(GL_DEPTH_TEST)); glsafe(::glEnable(GL_DEPTH_TEST));

View File

@ -983,8 +983,7 @@ void GLCanvas3D::SequentialPrintClearance::render()
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
glsafe(::glEnable(GL_DEPTH_TEST)); glsafe(::glEnable(GL_DEPTH_TEST));
@ -5826,8 +5825,7 @@ void GLCanvas3D::_render_camera_target()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
m_camera_target.axis[i].render(); m_camera_target.axis[i].render();

View File

@ -145,8 +145,7 @@ void GLGizmoCut::on_render()
} }
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
m_plane.render(); m_plane.render();

View File

@ -164,8 +164,7 @@ void GLGizmoMove3D::on_render()
#endif // ENABLE_GLBEGIN_GLEND_REMOVAL #endif // ENABLE_GLBEGIN_GLEND_REMOVAL
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
// draw axes // draw axes
@ -207,8 +206,7 @@ void GLGizmoMove3D::on_render()
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_grabber_connection(m_hover_id); render_grabber_connection(m_hover_id);

View File

@ -273,8 +273,7 @@ void GLGizmoScale3D::on_render()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
if (m_grabbers[0].enabled && m_grabbers[1].enabled) if (m_grabbers[0].enabled && m_grabbers[1].enabled)
render_grabbers_connection(0, 1, m_grabbers[0].color); render_grabbers_connection(0, 1, m_grabbers[0].color);
@ -323,8 +322,7 @@ void GLGizmoScale3D::on_render()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_grabbers_connection(0, 1, m_grabbers[0].color); render_grabbers_connection(0, 1, m_grabbers[0].color);
shader->stop_using(); shader->stop_using();
@ -359,8 +357,7 @@ void GLGizmoScale3D::on_render()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_grabbers_connection(2, 3, m_grabbers[2].color); render_grabbers_connection(2, 3, m_grabbers[2].color);
shader->stop_using(); shader->stop_using();
@ -395,8 +392,7 @@ void GLGizmoScale3D::on_render()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_grabbers_connection(4, 5, m_grabbers[4].color); render_grabbers_connection(4, 5, m_grabbers[4].color);
shader->stop_using(); shader->stop_using();
@ -431,8 +427,7 @@ void GLGizmoScale3D::on_render()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
render_grabbers_connection(6, 7, m_drag_color); render_grabbers_connection(6, 7, m_drag_color);
render_grabbers_connection(7, 8, m_drag_color); render_grabbers_connection(7, 8, m_drag_color);

View File

@ -97,8 +97,7 @@ void MeshClipper::render_cut()
if (shader != nullptr) { if (shader != nullptr) {
shader->start_using(); shader->start_using();
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix(); shader->set_uniform("projection_view_model_matrix", wxGetApp().plater()->get_camera().get_projection_view_matrix());
shader->set_uniform("projection_view_model_matrix", matrix);
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES #endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
m_model.set_color(color); m_model.set_color(color);
m_model.render(); m_model.render();