Only draw the slices in toolpath preview for the current selected layer
This commit is contained in:
parent
617fbaa9bd
commit
4c3fa999f5
@ -242,38 +242,39 @@ sub Render {
|
|||||||
foreach my $layer (@{$self->layers}) {
|
foreach my $layer (@{$self->layers}) {
|
||||||
my $object = $layer->object;
|
my $object = $layer->object;
|
||||||
|
|
||||||
|
# only draw the slice for the current layer
|
||||||
|
next unless abs($layer->print_z - $self->z) < epsilon;
|
||||||
|
|
||||||
# draw slice contour
|
# draw slice contour
|
||||||
{
|
glLineWidth(1);
|
||||||
glLineWidth(1);
|
foreach my $copy (@{ $object->_shifted_copies }) {
|
||||||
foreach my $copy (@{ $object->_shifted_copies }) {
|
glPushMatrix();
|
||||||
glPushMatrix();
|
glTranslatef(@$copy, 0);
|
||||||
glTranslatef(@$copy, 0);
|
|
||||||
|
foreach my $slice (@{$layer->slices}) {
|
||||||
|
glColor3f(0.95, 0.95, 0.95);
|
||||||
|
|
||||||
foreach my $slice (@{$layer->slices}) {
|
if ($tess) {
|
||||||
glColor3f(0.95, 0.95, 0.95);
|
gluTessBeginPolygon($tess);
|
||||||
|
|
||||||
if ($tess) {
|
|
||||||
gluTessBeginPolygon($tess);
|
|
||||||
foreach my $polygon (@$slice) {
|
|
||||||
gluTessBeginContour($tess);
|
|
||||||
gluTessVertex_p($tess, @$_, 0) for @$polygon;
|
|
||||||
gluTessEndContour($tess);
|
|
||||||
}
|
|
||||||
gluTessEndPolygon($tess);
|
|
||||||
}
|
|
||||||
|
|
||||||
glColor3f(0.9, 0.9, 0.9);
|
|
||||||
foreach my $polygon (@$slice) {
|
foreach my $polygon (@$slice) {
|
||||||
foreach my $line (@{$polygon->lines}) {
|
gluTessBeginContour($tess);
|
||||||
glBegin(GL_LINES);
|
gluTessVertex_p($tess, @$_, 0) for @$polygon;
|
||||||
glVertex2f(@{$line->a});
|
gluTessEndContour($tess);
|
||||||
glVertex2f(@{$line->b});
|
}
|
||||||
glEnd();
|
gluTessEndPolygon($tess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glColor3f(0.9, 0.9, 0.9);
|
||||||
|
foreach my $polygon (@$slice) {
|
||||||
|
foreach my $line (@{$polygon->lines}) {
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f(@{$line->a});
|
||||||
|
glVertex2f(@{$line->b});
|
||||||
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user