Support larger printer sizes by using 64-bit.

SuperSlicer is referenced for some changes.

Co-authored-by: Merill <merill@free.fr>
This commit is contained in:
SoftFever 2024-05-10 23:42:28 +08:00
parent 5bceebdd9d
commit 9b2c2bff1d
87 changed files with 380 additions and 362 deletions

View file

@ -72,7 +72,7 @@ namespace Slic3r {
#define SUPPORT_SURFACES_OFFSET_PARAMETERS ClipperLib::jtSquare, 0.
#ifdef SUPPORT_USE_AGG_RASTERIZER
static std::vector<unsigned char> rasterize_polygons(const Vec2i &grid_size, const double pixel_size, const Point &left_bottom, const Polygons &polygons)
static std::vector<unsigned char> rasterize_polygons(const Vec2i32 &grid_size, const double pixel_size, const Point &left_bottom, const Polygons &polygons)
{
std::vector<unsigned char> data(grid_size.x() * grid_size.y());
agg::rendering_buffer rendering_buffer(data.data(), unsigned(grid_size.x()), unsigned(grid_size.y()), grid_size.x());
@ -106,7 +106,7 @@ static std::vector<unsigned char> rasterize_polygons(const Vec2i &grid_size, con
return data;
}
// Grid has to have the boundary pixels unset.
static Polygons contours_simplified(const Vec2i &grid_size, const double pixel_size, Point left_bottom, const std::vector<unsigned char> &grid, coord_t offset, bool fill_holes)
static Polygons contours_simplified(const Vec2i32 &grid_size, const double pixel_size, Point left_bottom, const std::vector<unsigned char> &grid, coord_t offset, bool fill_holes)
{
assert(std::abs(2 * offset) < pixel_size - 10);
@ -542,13 +542,13 @@ public:
// Add one empty column / row boundaries.
m_bbox.offset(m_pixel_size);
// Grid size fitting the support polygons plus one pixel boundary around the polygons.
Vec2i grid_size_raw(int(ceil((m_bbox.max.x() - m_bbox.min.x()) / m_pixel_size)),
Vec2i32 grid_size_raw(int(ceil((m_bbox.max.x() - m_bbox.min.x()) / m_pixel_size)),
int(ceil((m_bbox.max.y() - m_bbox.min.y()) / m_pixel_size)));
// Overlay macro blocks of (oversampling x oversampling) over the grid.
Vec2i grid_blocks((grid_size_raw.x() + oversampling - 1 - 2) / oversampling,
Vec2i32 grid_blocks((grid_size_raw.x() + oversampling - 1 - 2) / oversampling,
(grid_size_raw.y() + oversampling - 1 - 2) / oversampling);
// and resize the grid to fit the macro blocks + one pixel boundary.
m_grid_size = grid_blocks * oversampling + Vec2i(2, 2);
m_grid_size = grid_blocks * oversampling + Vec2i32(2, 2);
assert(m_grid_size.x() >= grid_size_raw.x());
assert(m_grid_size.y() >= grid_size_raw.y());
m_grid2 = rasterize_polygons(m_grid_size, m_pixel_size, m_bbox.min, *m_support_polygons);
@ -837,7 +837,7 @@ private:
#ifdef SUPPORT_USE_AGG_RASTERIZER
// Dilate the trimming region (unmask the boundary pixels).
static std::vector<unsigned char> dilate_trimming_region(const std::vector<unsigned char> &trimming, const Vec2i &grid_size)
static std::vector<unsigned char> dilate_trimming_region(const std::vector<unsigned char> &trimming, const Vec2i32 &grid_size)
{
std::vector<unsigned char> dilated(trimming.size(), 0);
for (int r = 1; r + 1 < grid_size.y(); ++ r)
@ -858,7 +858,7 @@ private:
}
// Seed fill each of the (oversampling x oversampling) block up to the dilated trimming region.
static void seed_fill_block(std::vector<unsigned char> &grid, Vec2i grid_size, const std::vector<unsigned char> &trimming,const Vec2i &grid_blocks, int oversampling)
static void seed_fill_block(std::vector<unsigned char> &grid, Vec2i32 grid_size, const std::vector<unsigned char> &trimming,const Vec2i32 &grid_blocks, int oversampling)
{
int size = oversampling;
int stride = grid_size.x();
@ -968,7 +968,7 @@ private:
coordf_t m_support_material_closing_radius;
#ifdef SUPPORT_USE_AGG_RASTERIZER
Vec2i m_grid_size;
Vec2i32 m_grid_size;
double m_pixel_size;
BoundingBox m_bbox;
std::vector<unsigned char> m_grid2;