GCode Preview - Code cleanup

This commit is contained in:
Enrico Turri 2018-01-17 10:39:05 +01:00
parent c63e6b74fa
commit a417cf955d
24 changed files with 12 additions and 987 deletions

View file

@ -30,7 +30,6 @@ use Slic3r::Geometry qw(PI);
# _dirty: boolean flag indicating, that the screen has to be redrawn on EVT_IDLE.
# volumes: reference to vector of Slic3r::GUI::3DScene::Volume.
# _camera_type: 'perspective' or 'ortho'
# ===================== ENRICO_GCODE_PREVIEW ==================================================
__PACKAGE__->mk_accessors( qw(_quat _dirty init
enable_picking
enable_moving
@ -72,46 +71,6 @@ __PACKAGE__->mk_accessors( qw(_quat _dirty init
) );
#__PACKAGE__->mk_accessors( qw(_quat _dirty init
# enable_picking
# enable_moving
# use_plain_shader
# on_viewport_changed
# on_hover
# on_select
# on_double_click
# on_right_click
# on_move
# on_model_update
# volumes
# _sphi _stheta
# cutting_plane_z
# cut_lines_vertices
# bed_shape
# bed_triangles
# bed_grid_lines
# bed_polygon
# background
# origin
# _mouse_pos
# _hover_volume_idx
#
# _drag_volume_idx
# _drag_start_pos
# _drag_volume_center_offset
# _drag_start_xy
# _dragged
#
# _layer_height_edited
#
# _camera_type
# _camera_target
# _camera_distance
# _zoom
#
# ) );
# ===================== ENRICO_GCODE_PREVIEW ==================================================
use constant TRACKBALLSIZE => 0.8;
use constant TURNTABLE_MODE => 1;
use constant GROUND_Z => -0.02;
@ -181,9 +140,7 @@ sub new {
$self->_stheta(45);
$self->_sphi(45);
$self->_zoom(1);
# ===================== ENRICO_GCODE_PREVIEW ==================================================
$self->_legend_enabled(0);
# ===================== ENRICO_GCODE_PREVIEW ==================================================
$self->use_plain_shader(0);
# Collection of GLVolume objects
@ -256,12 +213,10 @@ sub new {
return $self;
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub set_legend_enabled {
my ($self, $value) = @_;
$self->_legend_enabled($value);
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub Destroy {
my ($self) = @_;
@ -1370,10 +1325,8 @@ sub Render {
glDisable(GL_BLEND);
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
# draw gcode preview legend
$self->draw_legend;
# ===================== ENRICO_GCODE_PREVIEW ==================================================
$self->draw_active_object_annotations;
@ -1508,29 +1461,9 @@ sub _variable_layer_thickness_load_reset_image {
# Paint the tooltip.
sub _render_image {
my ($self, $image, $l, $r, $b, $t) = @_;
# ===================== ENRICO_GCODE_PREVIEW ==================================================
$self->_render_texture($image->{texture_id}, $l, $r, $b, $t);
# glColor4f(1.,1.,1.,1.);
# glDisable(GL_LIGHTING);
# glEnable(GL_BLEND);
# glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
# glEnable(GL_TEXTURE_2D);
# glBindTexture(GL_TEXTURE_2D, $image->{texture_id});
# glBegin(GL_QUADS);
# glTexCoord2d(0.,1.); glVertex3f($l, $b, 0);
# glTexCoord2d(1.,1.); glVertex3f($r, $b, 0);
# glTexCoord2d(1.,0.); glVertex3f($r, $t, 0);
# glTexCoord2d(0.,0.); glVertex3f($l, $t, 0);
# glEnd();
# glBindTexture(GL_TEXTURE_2D, 0);
# glDisable(GL_TEXTURE_2D);
# glDisable(GL_BLEND);
# glEnable(GL_LIGHTING);
# ===================== ENRICO_GCODE_PREVIEW ==================================================
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub _render_texture {
my ($self, $tex_id, $l, $r, $b, $t) = @_;
@ -1551,7 +1484,6 @@ sub _render_texture {
glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub draw_active_object_annotations {
# $fakecolor is a boolean indicating, that the objects shall be rendered in a color coding the object index for picking.
@ -1665,7 +1597,6 @@ sub draw_active_object_annotations {
glEnable(GL_DEPTH_TEST);
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub draw_legend {
my ($self) = @_;
@ -1694,7 +1625,6 @@ sub draw_legend {
}
}
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub opengl_info
{
@ -2096,14 +2026,12 @@ sub load_wipe_tower_toolpaths {
if ($print->step_done(STEP_WIPE_TOWER));
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub load_gcode_preview {
my ($self, $print) = @_;
$self->SetCurrent($self->GetContext) if $self->UseVBOs;
Slic3r::GUI::_3DScene::load_gcode_preview($print, $self->volumes, $self->UseVBOs);
}
# ===================== ENRICO_GCODE_PREVIEW ==================================================
sub set_toolpaths_range {
my ($self, $min_z, $max_z) = @_;