Tech ENABLE_WORLD_COORDINATE_SHOW_AXES - Fixed bed axes visualization

This commit is contained in:
enricoturri1966 2022-05-12 11:26:44 +02:00
parent 19712749c3
commit fd45d0eeed

View File

@ -47,25 +47,14 @@ void CoordAxes::render(float emission_factor)
m_arrow.init_from(stilized_arrow(16, m_tip_radius, m_tip_length, m_stem_radius, m_stem_length));
GLShaderProgram* curr_shader = wxGetApp().get_current_shader();
#if ENABLE_GL_SHADERS_ATTRIBUTES
bool shader_differs = (curr_shader == nullptr || curr_shader->get_name() != "gouraud_light_attr");
#else
bool shader_differs = (curr_shader == nullptr || curr_shader->get_name() != "gouraud_light");
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
#if ENABLE_GL_SHADERS_ATTRIBUTES
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light_attr");
#else
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
if (shader == nullptr)
return;
if (shader_differs) {
if (curr_shader != nullptr)
curr_shader->stop_using();
shader->start_using();
}
if (curr_shader != nullptr)
curr_shader->stop_using();
shader->start_using();
shader->set_uniform("emission_factor", emission_factor);
// x axis
@ -104,11 +93,9 @@ void CoordAxes::render(float emission_factor)
render_axis(Geometry::assemble_transform(m_origin).cast<float>());
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
if (shader_differs) {
shader->stop_using();
if (curr_shader != nullptr)
curr_shader->start_using();
}
shader->stop_using();
if (curr_shader != nullptr)
curr_shader->start_using();
}
} // GUI