mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Render brim and skirt in 3D toolpaths preview. #2649
This commit is contained in:
parent
36ba2eb5d6
commit
c64308a5e7
4 changed files with 51 additions and 4 deletions
|
@ -937,7 +937,7 @@ package Slic3r::GUI::3DScene;
|
|||
use base qw(Slic3r::GUI::3DScene::Base);
|
||||
|
||||
use OpenGL qw(:glconstants :gluconstants :glufunctions);
|
||||
use List::Util qw(first);
|
||||
use List::Util qw(first min max);
|
||||
use Slic3r::Geometry qw(scale unscale epsilon);
|
||||
use Slic3r::Print::State ':steps';
|
||||
|
||||
|
@ -1079,6 +1079,50 @@ sub load_print_object_slices {
|
|||
);
|
||||
}
|
||||
|
||||
sub load_print_toolpaths {
|
||||
my ($self, $print) = @_;
|
||||
|
||||
return if !$print->step_done(STEP_SKIRT);
|
||||
return if !$print->step_done(STEP_BRIM);
|
||||
return if !$print->has_skirt && $print->config->brim_width == 0;
|
||||
|
||||
my $qverts = Slic3r::GUI::_3DScene::GLVertexArray->new;
|
||||
my $tverts = Slic3r::GUI::_3DScene::GLVertexArray->new;
|
||||
my %offsets = (); # print_z => [ qverts, tverts ]
|
||||
|
||||
my $skirt_height = 0; # number of layers
|
||||
if ($print->has_infinite_skirt) {
|
||||
$skirt_height = $print->total_layer_count;
|
||||
} else {
|
||||
$skirt_height = min($print->config->skirt_height, $print->total_layer_count);
|
||||
}
|
||||
foreach my $i (0..max(0, $skirt_height-1)) {
|
||||
my $layer = $print->get_object(0)->get_layer($i);
|
||||
my $top_z = $layer->print_z;
|
||||
$offsets{$top_z} = [$qverts->size, $tverts->size];
|
||||
|
||||
if ($i == 0) {
|
||||
$self->_extrusionentity_to_verts($print->brim, $top_z, Slic3r::Point->new(0,0), $qverts, $tverts);
|
||||
}
|
||||
|
||||
$self->_extrusionentity_to_verts($print->skirt, $top_z, Slic3r::Point->new(0,0), $qverts, $tverts);
|
||||
}
|
||||
|
||||
my $bb = Slic3r::Geometry::BoundingBoxf3->new;
|
||||
{
|
||||
my $pbb = $print->bounding_box;
|
||||
$bb->merge_point(Slic3r::Pointf3->new_unscale(@{$pbb->min_point}));
|
||||
$bb->merge_point(Slic3r::Pointf3->new_unscale(@{$pbb->max_point}));
|
||||
}
|
||||
push @{$self->volumes}, Slic3r::GUI::3DScene::Volume->new(
|
||||
bounding_box => $bb,
|
||||
color => COLORS->[2],
|
||||
qverts => $qverts,
|
||||
tverts => $tverts,
|
||||
offsets => { %offsets },
|
||||
);
|
||||
}
|
||||
|
||||
sub load_print_object_toolpaths {
|
||||
my ($self, $object) = @_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue