mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Only draw the slices in toolpath preview for the current selected layer
This commit is contained in:
		
							parent
							
								
									617fbaa9bd
								
							
						
					
					
						commit
						4c3fa999f5
					
				
					 1 changed files with 27 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -242,38 +242,39 @@ sub Render {
 | 
			
		|||
    foreach my $layer (@{$self->layers}) {
 | 
			
		||||
        my $object = $layer->object;
 | 
			
		||||
        
 | 
			
		||||
        # only draw the slice for the current layer
 | 
			
		||||
        next unless abs($layer->print_z - $self->z) < epsilon;
 | 
			
		||||
        
 | 
			
		||||
        # draw slice contour
 | 
			
		||||
        {
 | 
			
		||||
            glLineWidth(1);
 | 
			
		||||
            foreach my $copy (@{ $object->_shifted_copies }) {
 | 
			
		||||
                glPushMatrix();
 | 
			
		||||
                glTranslatef(@$copy, 0);
 | 
			
		||||
        glLineWidth(1);
 | 
			
		||||
        foreach my $copy (@{ $object->_shifted_copies }) {
 | 
			
		||||
            glPushMatrix();
 | 
			
		||||
            glTranslatef(@$copy, 0);
 | 
			
		||||
            
 | 
			
		||||
            foreach my $slice (@{$layer->slices}) {
 | 
			
		||||
                glColor3f(0.95, 0.95, 0.95);
 | 
			
		||||
                
 | 
			
		||||
                foreach my $slice (@{$layer->slices}) {
 | 
			
		||||
                    glColor3f(0.95, 0.95, 0.95);
 | 
			
		||||
                    
 | 
			
		||||
                    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);
 | 
			
		||||
                if ($tess) {
 | 
			
		||||
                    gluTessBeginPolygon($tess);
 | 
			
		||||
                    foreach my $polygon (@$slice) {
 | 
			
		||||
                        foreach my $line (@{$polygon->lines}) {
 | 
			
		||||
                            glBegin(GL_LINES);
 | 
			
		||||
                            glVertex2f(@{$line->a});
 | 
			
		||||
                            glVertex2f(@{$line->b});
 | 
			
		||||
                            glEnd();
 | 
			
		||||
                        }
 | 
			
		||||
                        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 $line (@{$polygon->lines}) {
 | 
			
		||||
                        glBegin(GL_LINES);
 | 
			
		||||
                        glVertex2f(@{$line->a});
 | 
			
		||||
                        glVertex2f(@{$line->b});
 | 
			
		||||
                        glEnd();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                glPopMatrix();
 | 
			
		||||
            }
 | 
			
		||||
            glPopMatrix();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue