mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 08:05:55 +08:00
Parallelized process_external_surfaces
This commit is contained in:
parent
db8396a290
commit
afacf0c99d
@ -419,4 +419,11 @@ Layer::detect_surfaces_type()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Layer::process_external_surfaces()
|
||||||
|
{
|
||||||
|
for (LayerRegion* &layerm : this->regions)
|
||||||
|
layerm->process_external_surfaces();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class LayerRegion
|
|||||||
void prepare_fill_surfaces();
|
void prepare_fill_surfaces();
|
||||||
void make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces);
|
void make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces);
|
||||||
void make_fill();
|
void make_fill();
|
||||||
void process_external_surfaces(const Layer* lower_layer);
|
void process_external_surfaces();
|
||||||
double infill_area_threshold() const;
|
double infill_area_threshold() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -111,6 +111,7 @@ class Layer {
|
|||||||
void make_perimeters();
|
void make_perimeters();
|
||||||
void make_fills();
|
void make_fills();
|
||||||
void detect_surfaces_type();
|
void detect_surfaces_type();
|
||||||
|
void process_external_surfaces();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
size_t _id; // sequential number of layer, 0-based
|
size_t _id; // sequential number of layer, 0-based
|
||||||
|
@ -65,8 +65,10 @@ LayerRegion::make_perimeters(const SurfaceCollection &slices, SurfaceCollection*
|
|||||||
g.process();
|
g.process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function reads lower_layer->slices and writes this->bridged and this->fill_surfaces,
|
||||||
|
// so it's thread-safe.
|
||||||
void
|
void
|
||||||
LayerRegion::process_external_surfaces(const Layer* lower_layer)
|
LayerRegion::process_external_surfaces()
|
||||||
{
|
{
|
||||||
const Surfaces &surfaces = this->fill_surfaces.surfaces;
|
const Surfaces &surfaces = this->fill_surfaces.surfaces;
|
||||||
const double margin = scale_(EXTERNAL_INFILL_MARGIN);
|
const double margin = scale_(EXTERNAL_INFILL_MARGIN);
|
||||||
@ -82,10 +84,10 @@ LayerRegion::process_external_surfaces(const Layer* lower_layer)
|
|||||||
also, supply the original expolygon instead of the grown one, because in case
|
also, supply the original expolygon instead of the grown one, because in case
|
||||||
of very thin (but still working) anchors, the grown expolygon would go beyond them */
|
of very thin (but still working) anchors, the grown expolygon would go beyond them */
|
||||||
double angle = -1;
|
double angle = -1;
|
||||||
if (lower_layer != NULL && surface->is_bridge()) {
|
if (this->layer()->lower_layer != NULL && surface->is_bridge()) {
|
||||||
BridgeDetector bd(
|
BridgeDetector bd(
|
||||||
surface->expolygon,
|
surface->expolygon,
|
||||||
lower_layer->slices,
|
this->layer()->lower_layer->slices,
|
||||||
this->flow(frInfill, true).scaled_width()
|
this->flow(frInfill, true).scaled_width()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -371,17 +371,11 @@ PrintObject::detect_surfaces_type()
|
|||||||
void
|
void
|
||||||
PrintObject::process_external_surfaces()
|
PrintObject::process_external_surfaces()
|
||||||
{
|
{
|
||||||
FOREACH_REGION(this->_print, region) {
|
parallelize<Layer*>(
|
||||||
size_t region_id = region - this->_print->regions.begin();
|
std::queue<Layer*>(std::deque<Layer*>(this->layers.begin(), this->layers.end())), // cast LayerPtrs to std::queue<Layer*>
|
||||||
|
boost::bind(&Slic3r::Layer::process_external_surfaces, _1),
|
||||||
FOREACH_LAYER(this, layer_it) {
|
this->_print->config.threads.value
|
||||||
const Layer* lower_layer = (layer_it == this->layers.begin())
|
);
|
||||||
? NULL
|
|
||||||
: *(layer_it-1);
|
|
||||||
|
|
||||||
(*layer_it)->get_region(region_id)->process_external_surfaces(lower_layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This method applies bridge flow to the first internal solid layer above
|
/* This method applies bridge flow to the first internal solid layer above
|
||||||
|
Loading…
x
Reference in New Issue
Block a user