mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 20:51:23 -07:00
Replaced Moose with Moo => big performance boost and easier packaging
This commit is contained in:
parent
bf5824781d
commit
26b05ab155
13 changed files with 67 additions and 75 deletions
|
|
@ -1,12 +1,12 @@
|
|||
package Slic3r::Layer;
|
||||
use Moose;
|
||||
use Moo;
|
||||
|
||||
use XXX;
|
||||
|
||||
# a sequential number of layer, starting at 0
|
||||
has 'id' => (
|
||||
is => 'ro',
|
||||
isa => 'Int',
|
||||
#isa => 'Int',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
|
|
@ -16,18 +16,15 @@ has 'id' => (
|
|||
has 'pointmap' => (
|
||||
traits => ['Hash'],
|
||||
is => 'rw',
|
||||
isa => 'HashRef[Slic3r::Point]',
|
||||
#isa => 'HashRef[Slic3r::Point]',
|
||||
default => sub { {} },
|
||||
handles => {
|
||||
points => 'values',
|
||||
},
|
||||
);
|
||||
|
||||
# collection of segments generated by slicing the original geometry
|
||||
# each segment is part of a closed polyline
|
||||
has 'lines' => (
|
||||
is => 'rw',
|
||||
isa => 'ArrayRef[Slic3r::Line]',
|
||||
#isa => 'ArrayRef[Slic3r::Line]',
|
||||
default => sub { [] },
|
||||
);
|
||||
|
||||
|
|
@ -35,21 +32,21 @@ has 'lines' => (
|
|||
has 'surfaces' => (
|
||||
traits => ['Array'],
|
||||
is => 'rw',
|
||||
isa => 'ArrayRef[Slic3r::Surface]',
|
||||
#isa => 'ArrayRef[Slic3r::Surface]',
|
||||
default => sub { [] },
|
||||
);
|
||||
|
||||
# ordered collection of extrusion paths to build all perimeters
|
||||
has 'perimeters' => (
|
||||
is => 'rw',
|
||||
isa => 'ArrayRef[Slic3r::ExtrusionPath]',
|
||||
#isa => 'ArrayRef[Slic3r::ExtrusionPath]',
|
||||
default => sub { [] },
|
||||
);
|
||||
|
||||
# ordered collection of extrusion paths to build skirt loops
|
||||
has 'skirts' => (
|
||||
is => 'rw',
|
||||
isa => 'ArrayRef[Slic3r::ExtrusionPath]',
|
||||
#isa => 'ArrayRef[Slic3r::ExtrusionPath]',
|
||||
default => sub { [] },
|
||||
);
|
||||
|
||||
|
|
@ -58,14 +55,14 @@ has 'skirts' => (
|
|||
has 'fill_surfaces' => (
|
||||
traits => ['Array'],
|
||||
is => 'rw',
|
||||
isa => 'ArrayRef[Slic3r::Surface]',
|
||||
#isa => 'ArrayRef[Slic3r::Surface]',
|
||||
default => sub { [] },
|
||||
);
|
||||
|
||||
# ordered collection of extrusion paths to fill surfaces
|
||||
has 'fills' => (
|
||||
is => 'rw',
|
||||
isa => 'ArrayRef[Slic3r::ExtrusionPath]',
|
||||
#isa => 'ArrayRef[Slic3r::ExtrusionPath]',
|
||||
default => sub { [] },
|
||||
);
|
||||
|
||||
|
|
@ -74,6 +71,11 @@ sub z {
|
|||
return $self->id * $Slic3r::layer_height / $Slic3r::resolution;
|
||||
}
|
||||
|
||||
sub points {
|
||||
my $self = shift;
|
||||
return values %{ $self->pointmap };
|
||||
}
|
||||
|
||||
sub add_surface {
|
||||
my $self = shift;
|
||||
my (@vertices) = @_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue