Code cleanup

This commit is contained in:
Enrico Turri 2018-06-22 16:11:00 +02:00
parent de540de9aa
commit c948ca647c
3 changed files with 5 additions and 24 deletions

View File

@ -142,7 +142,6 @@ sub new {
$self->rotate(rad2deg($angle_z), Z, 'absolute');
};
#===================================================================================================================================================
# callback to update object's geometry info while using gizmos
my $on_update_geometry_info = sub {
my ($size_x, $size_y, $size_z, $scale_factor) = @_;
@ -157,8 +156,6 @@ sub new {
}
}
};
#===================================================================================================================================================
# Initialize 3D plater
if ($Slic3r::GUI::have_OpenGL) {
@ -178,9 +175,7 @@ sub new {
Slic3r::GUI::_3DScene::register_on_enable_action_buttons_callback($self->{canvas3D}, $enable_action_buttons);
Slic3r::GUI::_3DScene::register_on_gizmo_scale_uniformly_callback($self->{canvas3D}, $on_gizmo_scale_uniformly);
Slic3r::GUI::_3DScene::register_on_gizmo_rotate_callback($self->{canvas3D}, $on_gizmo_rotate);
#===================================================================================================================================================
Slic3r::GUI::_3DScene::register_on_update_geometry_info_callback($self->{canvas3D}, $on_update_geometry_info);
#===================================================================================================================================================
Slic3r::GUI::_3DScene::enable_gizmos($self->{canvas3D}, 1);
Slic3r::GUI::_3DScene::enable_shader($self->{canvas3D}, 1);
Slic3r::GUI::_3DScene::enable_force_zoom_to_bed($self->{canvas3D}, 1);

View File

@ -1901,6 +1901,10 @@ void GLCanvas3D::update_gizmos_data()
m_gizmos.set_angle_z(model_instance->rotation);
break;
}
default:
{
break;
}
}
}
}
@ -3813,7 +3817,7 @@ int GLCanvas3D::_get_first_selected_volume_id() const
{
int object_id = vol->select_group_id / 1000000;
// Objects with object_id >= 1000 have a specific meaning, for example the wipe tower proxy.
if (object_id < 10000)
if ((object_id < 10000) && (object_id < objects_count))
{
int volume_id = 0;
for (int i = 0; i < object_id; ++i)

View File

@ -136,29 +136,11 @@ void GLTexture::render_texture(unsigned int tex_id, float left, float right, flo
::glBindTexture(GL_TEXTURE_2D, (GLuint)tex_id);
//###############################################################################################################################
::glBegin(GL_TRIANGLES);
::glTexCoord2f(0.0f, 1.0f); ::glVertex2f(left, bottom);
::glTexCoord2f(1.0f, 1.0f); ::glVertex2f(right, bottom);
::glTexCoord2f(1.0f, 0.0f); ::glVertex2f(right, top);
::glTexCoord2f(1.0f, 0.0f); ::glVertex2f(right, top);
::glTexCoord2f(0.0f, 0.0f); ::glVertex2f(left, top);
::glTexCoord2f(0.0f, 1.0f); ::glVertex2f(left, bottom);
/*
::glBegin(GL_QUADS);
::glTexCoord2f(0.0f, 1.0f); ::glVertex2f(left, bottom);
::glTexCoord2f(1.0f, 1.0f); ::glVertex2f(right, bottom);
::glTexCoord2f(1.0f, 0.0f); ::glVertex2f(right, top);
::glTexCoord2f(0.0f, 0.0f); ::glVertex2f(left, top);
*/
// ::glTexCoord2f(0.0f, 1.0f); ::glVertex3f(left, bottom, 0.0f);
// ::glTexCoord2f(1.0f, 1.0f); ::glVertex3f(right, bottom, 0.0f);
// ::glTexCoord2f(1.0f, 0.0f); ::glVertex3f(right, top, 0.0f);
// ::glTexCoord2f(0.0f, 0.0f); ::glVertex3f(left, top, 0.0f);
//###############################################################################################################################
::glEnd();
::glBindTexture(GL_TEXTURE_2D, 0);