mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-05 17:00:38 +08:00
Merge branch 'master' of https://github.com/Prusa-Development/PrusaSlicerPrivate into et_transformations
This commit is contained in:
commit
9141835b76
@ -1736,7 +1736,7 @@ private:
|
|||||||
void set_values(const std::initializer_list<std::string_view> il) {
|
void set_values(const std::initializer_list<std::string_view> il) {
|
||||||
m_values.clear();
|
m_values.clear();
|
||||||
m_values.reserve(il.size());
|
m_values.reserve(il.size());
|
||||||
for (const std::string_view p : il)
|
for (const std::string_view& p : il)
|
||||||
m_values.emplace_back(p);
|
m_values.emplace_back(p);
|
||||||
assert(m_labels.empty() || m_labels.size() == m_values.size());
|
assert(m_labels.empty() || m_labels.size() == m_values.size());
|
||||||
}
|
}
|
||||||
@ -1745,7 +1745,7 @@ private:
|
|||||||
m_values.reserve(il.size());
|
m_values.reserve(il.size());
|
||||||
m_labels.clear();
|
m_labels.clear();
|
||||||
m_labels.reserve(il.size());
|
m_labels.reserve(il.size());
|
||||||
for (const std::pair<std::string_view, std::string_view> p : il) {
|
for (const std::pair<std::string_view, std::string_view>& p : il) {
|
||||||
m_values.emplace_back(p.first);
|
m_values.emplace_back(p.first);
|
||||||
m_labels.emplace_back(p.second);
|
m_labels.emplace_back(p.second);
|
||||||
}
|
}
|
||||||
@ -1753,7 +1753,7 @@ private:
|
|||||||
void set_labels(const std::initializer_list<std::string_view> il) {
|
void set_labels(const std::initializer_list<std::string_view> il) {
|
||||||
m_labels.clear();
|
m_labels.clear();
|
||||||
m_labels.reserve(il.size());
|
m_labels.reserve(il.size());
|
||||||
for (const std::string_view p : il)
|
for (const std::string_view& p : il)
|
||||||
m_labels.emplace_back(p);
|
m_labels.emplace_back(p);
|
||||||
assert(m_values.empty() || m_labels.size() == m_values.size());
|
assert(m_values.empty() || m_labels.size() == m_values.size());
|
||||||
}
|
}
|
||||||
@ -1762,9 +1762,9 @@ private:
|
|||||||
// Check whether def.enum_values contains all the values of def.enum_keys_map and
|
// Check whether def.enum_values contains all the values of def.enum_keys_map and
|
||||||
// that they are sorted by their ordinary values.
|
// that they are sorted by their ordinary values.
|
||||||
m_values_ordinary = true;
|
m_values_ordinary = true;
|
||||||
for (const std::pair<std::string, int>& key : *m_enum_keys_map) {
|
for (const auto& [enum_name, enum_int] : *m_enum_keys_map) {
|
||||||
assert(key.second >= 0);
|
assert(enum_int >= 0);
|
||||||
if (key.second >= this->values().size() || this->value(key.second) != key.first) {
|
if (enum_int >= int(this->values().size()) || this->value(enum_int) != enum_name) {
|
||||||
m_values_ordinary = false;
|
m_values_ordinary = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +444,9 @@ private:
|
|||||||
|
|
||||||
MedialAxis::MedialAxis(double min_width, double max_width, const ExPolygon &expolygon) :
|
MedialAxis::MedialAxis(double min_width, double max_width, const ExPolygon &expolygon) :
|
||||||
m_expolygon(expolygon), m_lines(expolygon.lines()), m_min_width(min_width), m_max_width(max_width)
|
m_expolygon(expolygon), m_lines(expolygon.lines()), m_min_width(min_width), m_max_width(max_width)
|
||||||
{}
|
{
|
||||||
|
(void)m_expolygon; // supress unused variable warning
|
||||||
|
}
|
||||||
|
|
||||||
void MedialAxis::build(ThickPolylines* polylines)
|
void MedialAxis::build(ThickPolylines* polylines)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +356,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
|
|||||||
shell_width += perimeter_flow.scaled_spacing() * (num_perimeters - 1);
|
shell_width += perimeter_flow.scaled_spacing() * (num_perimeters - 1);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Maybe there is better solution when printing with zero perimeters, but this works reasonably well, given the situation
|
// TODO: Maybe there is better solution when printing with zero perimeters, but this works reasonably well, given the situation
|
||||||
shell_width = SCALED_EPSILON;
|
shell_width = float(SCALED_EPSILON);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scaled expansions of the respective external surfaces.
|
// Scaled expansions of the respective external surfaces.
|
||||||
|
@ -889,7 +889,6 @@ const BoundingBoxf3& ModelObject::bounding_box_exact() const
|
|||||||
if (! m_bounding_box_exact_valid) {
|
if (! m_bounding_box_exact_valid) {
|
||||||
m_bounding_box_exact_valid = true;
|
m_bounding_box_exact_valid = true;
|
||||||
m_min_max_z_valid = true;
|
m_min_max_z_valid = true;
|
||||||
BoundingBoxf3 raw_bbox = this->raw_mesh_bounding_box();
|
|
||||||
m_bounding_box_exact.reset();
|
m_bounding_box_exact.reset();
|
||||||
for (size_t i = 0; i < this->instances.size(); ++ i)
|
for (size_t i = 0; i < this->instances.size(); ++ i)
|
||||||
m_bounding_box_exact.merge(this->instance_bounding_box(i));
|
m_bounding_box_exact.merge(this->instance_bounding_box(i));
|
||||||
|
@ -1774,7 +1774,7 @@ void PrintObject::bridge_over_infill()
|
|||||||
Polygons infill_region = to_polygons(r->fill_expolygons());
|
Polygons infill_region = to_polygons(r->fill_expolygons());
|
||||||
Polygons deep_infill_area = closing(infill_region, scale_(0.01), scale_(0.01) + 4.0 * flow.scaled_spacing());
|
Polygons deep_infill_area = closing(infill_region, scale_(0.01), scale_(0.01) + 4.0 * flow.scaled_spacing());
|
||||||
Polygons solid_supported_area = expand(not_sparse_infill, 4.0 * flow.scaled_spacing());
|
Polygons solid_supported_area = expand(not_sparse_infill, 4.0 * flow.scaled_spacing());
|
||||||
infill_and_deep_infill_polygons_per_region[r] = {closing(infill_region, scale_(0.1)),
|
infill_and_deep_infill_polygons_per_region[r] = {closing(infill_region, float(scale_(0.1))),
|
||||||
intersection(lower_layers_sparse_infill,
|
intersection(lower_layers_sparse_infill,
|
||||||
diff(deep_infill_area, solid_supported_area))};
|
diff(deep_infill_area, solid_supported_area))};
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ SLAPrintObject::get_parts_to_slice(SLAPrintObjectStep untilstep) const
|
|||||||
|
|
||||||
std::vector<csg::CSGPart> ret;
|
std::vector<csg::CSGPart> ret;
|
||||||
|
|
||||||
for (int step = 0; step < s; ++step) {
|
for (unsigned int step = 0; step < s; ++step) {
|
||||||
auto r = m_mesh_to_slice.equal_range(SLAPrintObjectStep(step));
|
auto r = m_mesh_to_slice.equal_range(SLAPrintObjectStep(step));
|
||||||
csg::copy_csgrange_shallow(Range{r.first, r.second}, std::back_inserter(ret));
|
csg::copy_csgrange_shallow(Range{r.first, r.second}, std::back_inserter(ret));
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ indexed_triangle_set SLAPrint::Steps::generate_preview_vdb(
|
|||||||
auto r = range(po.m_mesh_to_slice);
|
auto r = range(po.m_mesh_to_slice);
|
||||||
auto grid = csg::voxelize_csgmesh(r, voxparams);
|
auto grid = csg::voxelize_csgmesh(r, voxparams);
|
||||||
auto m = grid ? grid_to_mesh(*grid, 0., 0.01) : indexed_triangle_set{};
|
auto m = grid ? grid_to_mesh(*grid, 0., 0.01) : indexed_triangle_set{};
|
||||||
float loss_less_max_error = 1e-6;
|
float loss_less_max_error = float(1e-6);
|
||||||
its_quadric_edge_collapse(m, 0U, &loss_less_max_error);
|
its_quadric_edge_collapse(m, 0U, &loss_less_max_error);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
@ -1114,7 +1114,7 @@ indexed_triangle_set its_make_sphere(double radius, double fa)
|
|||||||
std::vector<std::array<DividedEdge, 3>> divided_triangles(indices.size());
|
std::vector<std::array<DividedEdge, 3>> divided_triangles(indices.size());
|
||||||
std::vector<Vec3i> new_neighbors(4*indices.size());
|
std::vector<Vec3i> new_neighbors(4*indices.size());
|
||||||
|
|
||||||
size_t orig_indices_size = indices.size();
|
int orig_indices_size = int(indices.size());
|
||||||
for (int i=0; i<orig_indices_size; ++i) { // iterate over all old triangles
|
for (int i=0; i<orig_indices_size; ++i) { // iterate over all old triangles
|
||||||
|
|
||||||
// We are going to split this triangle. Let's foresee what will be the indices
|
// We are going to split this triangle. Let's foresee what will be the indices
|
||||||
|
@ -62,7 +62,11 @@ public:
|
|||||||
// Inherits coord_t x, y
|
// Inherits coord_t x, y
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEBUG_INTERSECTIONLINE (! defined(NDEBUG) || defined(SLIC3R_DEBUG_SLICE_PROCESSING))
|
#if (! defined(NDEBUG) || defined(SLIC3R_DEBUG_SLICE_PROCESSING))
|
||||||
|
#define DEBUG_INTERSECTION_LINE 1
|
||||||
|
#else
|
||||||
|
#define DEBUG_INTERSECTION_LINE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
class IntersectionLine : public Line
|
class IntersectionLine : public Line
|
||||||
{
|
{
|
||||||
|
@ -511,202 +511,38 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
|
|
||||||
// We'll now create the box with jagged edge. y-coordinates of the pre-generated model
|
// We'll now create the box with jagged edge. y-coordinates of the pre-generated model
|
||||||
// are shifted so that the front edge has y=0 and centerline of the back edge has y=depth:
|
// are shifted so that the front edge has y=0 and centerline of the back edge has y=depth:
|
||||||
// We split the box in three main pieces,
|
float out_points_idx[][3] = { { 0, -depth, 0 }, { 0, 0, 0 }, { 38.453f, 0, 0 }, { 61.547f, 0, 0 }, { 100.0f, 0, 0 }, { 100.0f, -depth, 0 }, { 55.7735f, -10.0f, 0 }, { 44.2265f, 10.0f, 0 },
|
||||||
// the two laterals are identical and the central is the one containing the jagged geometry
|
{ 38.453f, 0, 1 }, { 0, 0, 1 }, { 0, -depth, 1 }, { 100.0f, -depth, 1 }, { 100.0f, 0, 1 }, { 61.547f, 0, 1 }, { 55.7735f, -10.0f, 1 }, { 44.2265f, 10.0f, 1 } };
|
||||||
|
static constexpr const int out_facets_idx[][3] = {
|
||||||
// lateral parts generator
|
{ 0, 1, 2 }, { 3, 4, 5 }, { 6, 5, 0 }, { 3, 5, 6 }, { 6, 2, 7 }, { 6, 0, 2 }, { 8, 9, 10 }, { 11, 12, 13 }, { 10, 11, 14 }, { 14, 11, 13 }, { 15, 8, 14 },
|
||||||
auto generate_lateral = [&](float min_x, float max_x) {
|
{ 8, 10, 14 }, { 3, 12, 4 }, { 3, 13, 12 }, { 6, 13, 3 }, { 6, 14, 13 }, { 7, 14, 6 }, { 7, 15, 14 }, { 2, 15, 7 }, { 2, 8, 15 }, { 1, 8, 2 }, { 1, 9, 8 },
|
||||||
const std::vector<Vec3f> vertices = {
|
{ 0, 9, 1 }, { 0, 10, 9 }, { 5, 10, 0 }, { 5, 11, 10 }, { 4, 11, 5 }, { 4, 12, 11 } };
|
||||||
{ min_x, -(depth + brim_width), 0.0f },
|
|
||||||
{ max_x, -(depth + brim_width), 0.0f },
|
|
||||||
{ min_x, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ max_x, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ min_x, -depth, scaled_brim_height },
|
|
||||||
{ max_x, -depth, scaled_brim_height },
|
|
||||||
{ min_x, -depth, 1.0f },
|
|
||||||
{ max_x, -depth, 1.0f },
|
|
||||||
{ min_x, 0.0f, 1.0f },
|
|
||||||
{ max_x, 0.0f, 1.0f },
|
|
||||||
{ min_x, 0.0f, scaled_brim_height },
|
|
||||||
{ max_x, 0.0f, scaled_brim_height },
|
|
||||||
{ min_x, brim_width, scaled_brim_height },
|
|
||||||
{ max_x, brim_width, scaled_brim_height },
|
|
||||||
{ min_x, brim_width, 0.0f },
|
|
||||||
{ max_x, brim_width, 0.0f }
|
|
||||||
};
|
|
||||||
const std::vector<Vec3i> triangles = {
|
|
||||||
{ 0, 1, 3 }, { 0, 3, 2 }, { 2, 3, 5 }, { 2, 5, 4 }, { 4, 5, 7 }, { 4, 7, 6 }, { 6, 7, 9 }, { 6, 9, 8 },
|
|
||||||
{ 8, 9, 11 }, { 8, 11, 10 }, { 10, 11, 13 }, { 10, 13, 12 }, { 12, 13, 15 }, { 12, 15, 14 }, { 14, 15, 1 }, { 14, 1, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
indexed_triangle_set its;
|
indexed_triangle_set its;
|
||||||
its.vertices.reserve(vertices.size());
|
for (int i = 0; i < 16; ++i)
|
||||||
for (const Vec3f& v : vertices) {
|
its.vertices.emplace_back(out_points_idx[i][0] / (100.f / min_width), out_points_idx[i][1] + depth, out_points_idx[i][2]);
|
||||||
its.vertices.emplace_back(v.x(), v.y() + depth, v.z());
|
its.indices.reserve(28);
|
||||||
}
|
for (const int* face : out_facets_idx)
|
||||||
its.indices.reserve(triangles.size());
|
its.indices.emplace_back(face);
|
||||||
for (const Vec3i& t : triangles) {
|
TriangleMesh tooth_mesh(std::move(its));
|
||||||
its.indices.emplace_back(t);
|
|
||||||
}
|
|
||||||
return its;
|
|
||||||
};
|
|
||||||
|
|
||||||
// central parts generator
|
|
||||||
auto generate_central = [&]() {
|
|
||||||
const std::vector<Vec3f> vertices = {
|
|
||||||
// this part is not watertight to avoid to have different geometries for the cases
|
|
||||||
// brim_width < 10.0
|
|
||||||
// brim_width == 10.0
|
|
||||||
// brim_width > 10.0
|
|
||||||
{ 38.453f, -(depth + brim_width), 0.0f },
|
|
||||||
{ 61.547f, -(depth + brim_width), 0.0f },
|
|
||||||
{ 38.453f, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ 61.547f, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ 38.453f, -depth, scaled_brim_height },
|
|
||||||
{ 61.547f, -depth, scaled_brim_height },
|
|
||||||
{ 38.453f, -depth, 1.0f },
|
|
||||||
{ 61.547f, -depth, 1.0f },
|
|
||||||
{ 38.453f, 0.0f, 1.0f },
|
|
||||||
{ 44.2265f, 10.0f, 1.0f },
|
|
||||||
{ 50.0f, 0.0f, 1.0f },
|
|
||||||
{ 55.7735f, -10.0f, 1.0f },
|
|
||||||
{ 61.547f, 0.0f, 1.0f },
|
|
||||||
{ 38.453f, 0.0f, scaled_brim_height },
|
|
||||||
{ 44.2265f, 10.0f, scaled_brim_height },
|
|
||||||
{ 50.0f, 0.0f, scaled_brim_height },
|
|
||||||
{ 55.7735f, -10.0f, scaled_brim_height },
|
|
||||||
{ 61.547f, 0.0f, scaled_brim_height },
|
|
||||||
{ 38.453f, 0.0f, 0.0f },
|
|
||||||
{ 44.2265f, 10.0f, 0.0f },
|
|
||||||
{ 50.0f, 0.0f, 0.0f },
|
|
||||||
{ 55.7735f, -10.0f, 0.0f },
|
|
||||||
{ 61.547f, 0.0f, 0.0f },
|
|
||||||
{ 38.453f, brim_width, scaled_brim_height },
|
|
||||||
{ 61.547f, brim_width, scaled_brim_height },
|
|
||||||
{ 38.453f, brim_width, 0.0f },
|
|
||||||
{ 61.547f, brim_width, 0.0f },
|
|
||||||
};
|
|
||||||
|
|
||||||
const std::vector<Vec3i> triangles = {
|
|
||||||
{ 0, 1, 3 }, { 0, 3, 2 }, { 2, 3, 5 }, { 2, 5, 4 }, { 4, 5, 7 }, { 4, 7, 6 },
|
|
||||||
{ 6, 7, 11 }, { 6, 11, 10 }, { 6, 10, 8 }, { 8, 10, 9 }, { 11, 7, 12 }, { 14, 13, 8 },
|
|
||||||
{ 14, 8, 9 }, { 19, 18, 13 }, { 19, 13, 14 }, { 15, 14, 9 }, { 15, 9, 10 }, { 20, 19, 14 },
|
|
||||||
{ 20, 14, 15 }, { 16, 15, 10 }, { 16, 10, 11 }, { 21, 20, 15 }, { 21, 15, 16 }, { 17, 16, 11 },
|
|
||||||
{ 17, 11, 12 }, { 22, 21, 16 }, { 22, 16, 17 }, { 15, 16, 17 }, { 13, 15, 23 }, { 15, 17, 24 },
|
|
||||||
{ 15, 24, 23 }, { 26, 25, 23 }, { 26, 23, 24 }, { 0, 25, 1 }, { 1, 25, 26 }, { 20, 18, 19 }
|
|
||||||
};
|
|
||||||
|
|
||||||
indexed_triangle_set its;
|
|
||||||
its.vertices.reserve(vertices.size());
|
|
||||||
for (const Vec3f& v : vertices) {
|
|
||||||
its.vertices.emplace_back(v.x(), v.y() + depth, v.z());
|
|
||||||
}
|
|
||||||
its.indices.reserve(triangles.size());
|
|
||||||
for (const Vec3i& t : triangles) {
|
|
||||||
its.indices.emplace_back(t);
|
|
||||||
}
|
|
||||||
return its;
|
|
||||||
};
|
|
||||||
|
|
||||||
TriangleMesh tooth_mesh;
|
|
||||||
indexed_triangle_set data = generate_lateral(0.0f, 38.453f);
|
|
||||||
tooth_mesh.merge(TriangleMesh(std::move(data)));
|
|
||||||
data = generate_central();
|
|
||||||
tooth_mesh.merge(TriangleMesh(std::move(data)));
|
|
||||||
data = generate_lateral(61.547f, 100.0f);
|
|
||||||
tooth_mesh.merge(TriangleMesh(std::move(data)));
|
|
||||||
|
|
||||||
// We have the mesh ready. It has one tooth and width of min_width. We will now
|
// We have the mesh ready. It has one tooth and width of min_width. We will now
|
||||||
// append several of these together until we are close to the required width
|
// append several of these together until we are close to the required width
|
||||||
// of the block. Than we can scale it precisely.
|
// of the block. Than we can scale it precisely.
|
||||||
const size_t n = std::max(1, int(width / min_width)); // How many shall be merged?
|
size_t n = std::max(1, int(width / min_width)); // How many shall be merged?
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
mesh.merge(tooth_mesh);
|
mesh.merge(tooth_mesh);
|
||||||
tooth_mesh.translate(100.0f, 0.0f, 0.0f);
|
tooth_mesh.translate(min_width, 0.f, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we add the caps along the X axis
|
mesh.scale(Vec3f(width / (n * min_width), 1.f, height)); // Scaling to proper width
|
||||||
const float scaled_brim_width_x = brim_width * n * width / min_width;
|
|
||||||
auto generate_negx_cap = [&]() {
|
|
||||||
const std::vector<Vec3f> vertices = {
|
|
||||||
{ -scaled_brim_width_x, -(depth + brim_width), 0.0f },
|
|
||||||
{ 0.0f, -(depth + brim_width), 0.0f },
|
|
||||||
{ -scaled_brim_width_x, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ 0.0f, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ 0.0f, -depth, scaled_brim_height },
|
|
||||||
{ 0.0f, -depth, 1.0f },
|
|
||||||
{ 0.0f, 0.0f, 1.0f },
|
|
||||||
{ 0.0f, 0.0f, scaled_brim_height },
|
|
||||||
{ 0.0f, brim_width, scaled_brim_height },
|
|
||||||
{ -scaled_brim_width_x, brim_width, scaled_brim_height },
|
|
||||||
{ 0.0f, brim_width, 0.0f },
|
|
||||||
{ -scaled_brim_width_x, brim_width, 0.0f }
|
|
||||||
};
|
|
||||||
|
|
||||||
const std::vector<Vec3i> triangles = {
|
|
||||||
{ 0, 1, 3 }, { 0, 3, 2 }, { 2, 3, 4 }, { 2, 4, 9 }, { 9, 4, 7 }, { 9, 7, 8 }, { 9, 8, 10 }, { 9, 10, 11 },
|
|
||||||
{ 11, 10, 1 }, { 11, 1, 0 }, { 11, 0, 2 }, { 11, 2, 9 }, { 7, 4, 5 }, { 7, 5, 6 }
|
|
||||||
};
|
|
||||||
|
|
||||||
indexed_triangle_set its;
|
|
||||||
its.vertices.reserve(vertices.size());
|
|
||||||
for (const Vec3f& v : vertices) {
|
|
||||||
its.vertices.emplace_back(v.x(), v.y() + depth, v.z());
|
|
||||||
}
|
}
|
||||||
its.indices.reserve(triangles.size());
|
else
|
||||||
for (const Vec3i& t : triangles) {
|
mesh = make_cube(width, depth, height);
|
||||||
its.indices.emplace_back(t);
|
|
||||||
}
|
|
||||||
return its;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto generate_posx_cap = [&]() {
|
// We'll make another mesh to show the brim (fixed layer height):
|
||||||
const float posx_cap_x = n * 100.0f;
|
TriangleMesh brim_mesh = make_cube(width + 2.f * brim_width, depth + 2.f * brim_width, 0.2f);
|
||||||
const std::vector<Vec3f> vertices = {
|
brim_mesh.translate(-brim_width, -brim_width, 0.f);
|
||||||
{ posx_cap_x, -(depth + brim_width), 0.0f },
|
|
||||||
{ posx_cap_x + scaled_brim_width_x, -(depth + brim_width), 0.0f },
|
|
||||||
{ posx_cap_x, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ posx_cap_x + scaled_brim_width_x, -(depth + brim_width), scaled_brim_height },
|
|
||||||
{ posx_cap_x, -depth, scaled_brim_height },
|
|
||||||
{ posx_cap_x, -depth, 1.0f },
|
|
||||||
{ posx_cap_x, 0.0f, 1.0f },
|
|
||||||
{ posx_cap_x, 0.0f, scaled_brim_height },
|
|
||||||
{ posx_cap_x, brim_width, scaled_brim_height },
|
|
||||||
{ posx_cap_x + scaled_brim_width_x, brim_width, scaled_brim_height },
|
|
||||||
{ posx_cap_x, brim_width, 0.0f },
|
|
||||||
{ posx_cap_x + scaled_brim_width_x, brim_width, 0.0f }
|
|
||||||
};
|
|
||||||
|
|
||||||
const std::vector<Vec3i> triangles = {
|
|
||||||
{ 0, 1, 3 }, { 0, 3, 2 }, { 2, 3, 4 }, { 4, 3, 9 }, { 4, 9, 7 }, { 7, 9, 8 }, { 8, 9, 11 }, { 8, 11, 10 },
|
|
||||||
{ 10, 11, 1 }, { 10, 1, 0 }, { 1, 11, 9 }, { 1, 9, 3 }, { 4, 7, 6 }, { 4, 6, 5 }
|
|
||||||
};
|
|
||||||
|
|
||||||
indexed_triangle_set its;
|
|
||||||
its.vertices.reserve(vertices.size());
|
|
||||||
for (const Vec3f& v : vertices) {
|
|
||||||
its.vertices.emplace_back(v.x(), v.y() + depth, v.z());
|
|
||||||
}
|
|
||||||
its.indices.reserve(triangles.size());
|
|
||||||
for (const Vec3i& t : triangles) {
|
|
||||||
its.indices.emplace_back(t);
|
|
||||||
}
|
|
||||||
return its;
|
|
||||||
};
|
|
||||||
|
|
||||||
data = generate_negx_cap();
|
|
||||||
mesh.merge(TriangleMesh(std::move(data)));
|
|
||||||
data = generate_posx_cap();
|
|
||||||
mesh.merge(TriangleMesh(std::move(data)));
|
|
||||||
mesh.scale(Vec3f(width / (n * 100.0f), 1.0f, height)); // Scaling to proper width
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mesh = make_cube(width, depth, height - brim_height);
|
|
||||||
mesh.translate(0.0f, 0.0f, brim_height);
|
|
||||||
TriangleMesh brim_mesh = make_cube(width + 2.0f * brim_width, depth + 2.0f * brim_width, brim_height);
|
|
||||||
brim_mesh.translate(-brim_width, -brim_width, 0.0f);
|
|
||||||
mesh.merge(brim_mesh);
|
mesh.merge(brim_mesh);
|
||||||
}
|
|
||||||
|
|
||||||
volumes.emplace_back(new GLVolume(color));
|
volumes.emplace_back(new GLVolume(color));
|
||||||
GLVolume& v = *volumes.back();
|
GLVolume& v = *volumes.back();
|
||||||
|
@ -113,8 +113,6 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto style = config->opt_enum<SupportMaterialStyle>("support_material_style");
|
|
||||||
|
|
||||||
if (config->opt_bool("wipe_tower") && config->opt_bool("support_material") &&
|
if (config->opt_bool("wipe_tower") && config->opt_bool("support_material") &&
|
||||||
// Organic supports are always synchronized with object layers as of now.
|
// Organic supports are always synchronized with object layers as of now.
|
||||||
config->opt_enum<SupportMaterialStyle>("support_material_style") != smsOrganic) {
|
config->opt_enum<SupportMaterialStyle>("support_material_style") != smsOrganic) {
|
||||||
|
@ -988,7 +988,6 @@ void Choice::BUILD() {
|
|||||||
|
|
||||||
choice_ctrl* temp;
|
choice_ctrl* temp;
|
||||||
if (m_opt.gui_type != ConfigOptionDef::GUIType::undefined
|
if (m_opt.gui_type != ConfigOptionDef::GUIType::undefined
|
||||||
&& m_opt.gui_type != ConfigOptionDef::GUIType::select_open
|
|
||||||
&& m_opt.gui_type != ConfigOptionDef::GUIType::select_close) {
|
&& m_opt.gui_type != ConfigOptionDef::GUIType::select_close) {
|
||||||
m_is_editable = true;
|
m_is_editable = true;
|
||||||
temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxTE_PROCESS_ENTER);
|
temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, nullptr, wxTE_PROCESS_ENTER);
|
||||||
|
@ -64,26 +64,6 @@ static GLModel::Geometry its_make_line(Vec3f beg_pos, Vec3f end_pos)
|
|||||||
return init_data;
|
return init_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates mesh for a square plane
|
|
||||||
static GLModel::Geometry its_make_square_plane(float radius)
|
|
||||||
{
|
|
||||||
GLModel::Geometry init_data;
|
|
||||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3 };
|
|
||||||
init_data.reserve_vertices(4);
|
|
||||||
init_data.reserve_indices(6);
|
|
||||||
|
|
||||||
// vertices
|
|
||||||
init_data.add_vertex(Vec3f(-radius, -radius, 0.0));
|
|
||||||
init_data.add_vertex(Vec3f(radius , -radius, 0.0));
|
|
||||||
init_data.add_vertex(Vec3f(radius , radius , 0.0));
|
|
||||||
init_data.add_vertex(Vec3f(-radius, radius , 0.0));
|
|
||||||
|
|
||||||
// indices
|
|
||||||
init_data.add_triangle(0, 1, 2);
|
|
||||||
init_data.add_triangle(2, 3, 0);
|
|
||||||
return init_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! -- #ysFIXME those functions bodies are ported from GizmoRotation
|
//! -- #ysFIXME those functions bodies are ported from GizmoRotation
|
||||||
// Generates mesh for a circle
|
// Generates mesh for a circle
|
||||||
static void init_from_circle(GLModel& model, double radius)
|
static void init_from_circle(GLModel& model, double radius)
|
||||||
@ -627,36 +607,6 @@ bool GLGizmoCut3D::render_reset_button(const std::string& label_id, const std::s
|
|||||||
return revert;
|
return revert;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Vec2d ndc_to_ss(const Vec3d& ndc, const std::array<int, 4>& viewport) {
|
|
||||||
const double half_w = 0.5 * double(viewport[2]);
|
|
||||||
const double half_h = 0.5 * double(viewport[3]);
|
|
||||||
return { half_w * ndc.x() + double(viewport[0]) + half_w, half_h * ndc.y() + double(viewport[1]) + half_h };
|
|
||||||
};
|
|
||||||
static Vec3d clip_to_ndc(const Vec4d& clip) {
|
|
||||||
return Vec3d(clip.x(), clip.y(), clip.z()) / clip.w();
|
|
||||||
}
|
|
||||||
static Vec4d world_to_clip(const Vec3d& world, const Matrix4d& projection_view_matrix) {
|
|
||||||
return projection_view_matrix * Vec4d(world.x(), world.y(), world.z(), 1.0);
|
|
||||||
}
|
|
||||||
static Vec2d world_to_ss(const Vec3d& world, const Matrix4d& projection_view_matrix, const std::array<int, 4>& viewport) {
|
|
||||||
return ndc_to_ss(clip_to_ndc(world_to_clip(world, projection_view_matrix)), viewport);
|
|
||||||
}
|
|
||||||
|
|
||||||
static wxString get_label(Vec3d vec)
|
|
||||||
{
|
|
||||||
wxString str = "x=" + double_to_string(vec.x(), 2) +
|
|
||||||
", y=" + double_to_string(vec.y(), 2) +
|
|
||||||
", z=" + double_to_string(vec.z(), 2);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static wxString get_label(Vec2d vec)
|
|
||||||
{
|
|
||||||
wxString str = "x=" + double_to_string(vec.x(), 2) +
|
|
||||||
", y=" + double_to_string(vec.y(), 2);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLGizmoCut3D::render_cut_plane()
|
void GLGizmoCut3D::render_cut_plane()
|
||||||
{
|
{
|
||||||
if (cut_line_processing())
|
if (cut_line_processing())
|
||||||
|
@ -1937,19 +1937,19 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (m_mode == EMode::FeatureSelection && m_hover_id != -1) {
|
if (m_mode == EMode::FeatureSelection && m_hover_id != -1) {
|
||||||
add_strings_row_to_table(*m_imgui, _u8L("Shift"), ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Enable point selection"), ImGui::GetStyleColorVec4(ImGuiCol_Text));
|
add_strings_row_to_table(*m_imgui, "Shift", ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Enable point selection"), ImGui::GetStyleColorVec4(ImGuiCol_Text));
|
||||||
++row_count;
|
++row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_selected_features.first.feature.has_value()) {
|
if (m_selected_features.first.feature.has_value()) {
|
||||||
add_strings_row_to_table(*m_imgui, _u8L("Delete"), ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Restart selection"), ImGui::GetStyleColorVec4(ImGuiCol_Text));
|
add_strings_row_to_table(*m_imgui, "Delete", ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Restart selection"), ImGui::GetStyleColorVec4(ImGuiCol_Text));
|
||||||
++row_count;
|
++row_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_selected_features.first.feature.has_value() || m_selected_features.second.feature.has_value()) {
|
if (m_selected_features.first.feature.has_value() || m_selected_features.second.feature.has_value()) {
|
||||||
add_row_to_table(
|
add_row_to_table(
|
||||||
[this]() {
|
[this]() {
|
||||||
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Esc"));
|
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Esc");
|
||||||
},
|
},
|
||||||
[this]() {
|
[this]() {
|
||||||
m_imgui->text_colored(ImGui::GetStyleColorVec4(ImGuiCol_Text), _u8L("Unselect"));
|
m_imgui->text_colored(ImGui::GetStyleColorVec4(ImGuiCol_Text), _u8L("Unselect"));
|
||||||
|
@ -633,7 +633,6 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
|
|||||||
|
|
||||||
Choice* choice = dynamic_cast<Choice*>(ht);
|
Choice* choice = dynamic_cast<Choice*>(ht);
|
||||||
choice->set_values(types);
|
choice->set_values(types);
|
||||||
int dif = (int)ht->m_opt.enum_def->values().size() - (int)types.size();
|
|
||||||
int index_in_choice = (printer_change ? std::clamp(last_in_conf - ((int)ht->m_opt.enum_def->values().size() - (int)types.size()), 0, (int)ht->m_opt.enum_def->values().size() - 1) : last_in_conf);
|
int index_in_choice = (printer_change ? std::clamp(last_in_conf - ((int)ht->m_opt.enum_def->values().size() - (int)types.size()), 0, (int)ht->m_opt.enum_def->values().size() - 1) : last_in_conf);
|
||||||
choice->set_value(index_in_choice);
|
choice->set_value(index_in_choice);
|
||||||
if (link.supported && link.label == _(ht->m_opt.enum_def->label(index_in_choice)))
|
if (link.supported && link.label == _(ht->m_opt.enum_def->label(index_in_choice)))
|
||||||
|
@ -188,25 +188,6 @@ static void append_enum_option( std::shared_ptr<ConfigOptionsGroup> optgroup,
|
|||||||
wxGetApp().sidebar().get_searcher().add_key(opt_key, Preset::TYPE_PREFERENCES, optgroup->config_category(), L("Preferences"));
|
wxGetApp().sidebar().get_searcher().add_key(opt_key, Preset::TYPE_PREFERENCES, optgroup->config_category(), L("Preferences"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void append_string_option(std::shared_ptr<ConfigOptionsGroup> optgroup,
|
|
||||||
const std::string& opt_key,
|
|
||||||
const std::string& label,
|
|
||||||
const std::string& tooltip,
|
|
||||||
const std::string& def_val,
|
|
||||||
ConfigOptionMode mode = comSimple)
|
|
||||||
{
|
|
||||||
ConfigOptionDef def = { opt_key, coString };
|
|
||||||
def.label = label;
|
|
||||||
def.tooltip = tooltip;
|
|
||||||
def.mode = mode;
|
|
||||||
def.set_default_value(new ConfigOptionString{ def_val });
|
|
||||||
Option option(def, opt_key);
|
|
||||||
optgroup->append_single_option_line(option);
|
|
||||||
|
|
||||||
// fill data to the Search Dialog
|
|
||||||
wxGetApp().sidebar().get_searcher().add_key(opt_key, Preset::TYPE_PREFERENCES, optgroup->config_category(), L("Preferences"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void append_preferences_option_to_searcher(std::shared_ptr<ConfigOptionsGroup> optgroup,
|
static void append_preferences_option_to_searcher(std::shared_ptr<ConfigOptionsGroup> optgroup,
|
||||||
const std::string& opt_key,
|
const std::string& opt_key,
|
||||||
const wxString& label)
|
const wxString& label)
|
||||||
|
@ -197,7 +197,7 @@ std::string PrintHostSendDialog::storage() const
|
|||||||
{
|
{
|
||||||
if (!combo_storage)
|
if (!combo_storage)
|
||||||
return GUI::format("%1%", m_preselected_storage);
|
return GUI::format("%1%", m_preselected_storage);
|
||||||
if (combo_storage->GetSelection() < 0 || combo_storage->GetSelection() >= m_paths.size())
|
if (combo_storage->GetSelection() < 0 || combo_storage->GetSelection() >= int(m_paths.size()))
|
||||||
return {};
|
return {};
|
||||||
return boost::nowide::narrow(m_paths[combo_storage->GetSelection()]);
|
return boost::nowide::narrow(m_paths[combo_storage->GetSelection()]);
|
||||||
}
|
}
|
||||||
|
@ -458,44 +458,6 @@ wxBitmapBundle* get_solid_bmp_bundle(int width, int height, const std::string& c
|
|||||||
#endif // __WXGTK2__
|
#endif // __WXGTK2__
|
||||||
}
|
}
|
||||||
|
|
||||||
// win is used to get a correct em_unit value
|
|
||||||
// It's important for bitmaps of dialogs.
|
|
||||||
// if win == nullptr, em_unit value of MainFrame will be used
|
|
||||||
wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
|
|
||||||
wxWindow *win/* = nullptr*/,
|
|
||||||
const int px_cnt/* = 16*/,
|
|
||||||
const bool grayscale/* = false*/,
|
|
||||||
const std::string& new_color/* = std::string()*/, // color witch will used instead of orange
|
|
||||||
const bool menu_bitmap/* = false*/)
|
|
||||||
{
|
|
||||||
static Slic3r::GUI::BitmapCache cache;
|
|
||||||
|
|
||||||
unsigned int width = 0;
|
|
||||||
unsigned int height = (unsigned int)(em_unit(win) * px_cnt * 0.1f + 0.5f);
|
|
||||||
|
|
||||||
std::string bmp_name = bmp_name_in;
|
|
||||||
boost::replace_last(bmp_name, ".png", "");
|
|
||||||
|
|
||||||
bool dark_mode =
|
|
||||||
#ifdef _WIN32
|
|
||||||
menu_bitmap ? Slic3r::GUI::check_dark_mode() :
|
|
||||||
#endif
|
|
||||||
Slic3r::GUI::wxGetApp().dark_mode();
|
|
||||||
|
|
||||||
// Try loading an SVG first, then PNG if SVG is not found:
|
|
||||||
wxBitmap *bmp = cache.load_svg(bmp_name, width, height, grayscale, dark_mode, new_color);
|
|
||||||
if (bmp == nullptr) {
|
|
||||||
bmp = cache.load_png(bmp_name, width, height, grayscale);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bmp == nullptr) {
|
|
||||||
// Neither SVG nor PNG has been found, raise error
|
|
||||||
throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<wxBitmapBundle*> get_extruder_color_icons(bool thin_icon/* = false*/)
|
std::vector<wxBitmapBundle*> get_extruder_color_icons(bool thin_icon/* = false*/)
|
||||||
{
|
{
|
||||||
// Create the bitmap with color bars.
|
// Create the bitmap with color bars.
|
||||||
@ -736,7 +698,6 @@ void ModeButton::sys_color_changed()
|
|||||||
|
|
||||||
ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 0*/) :
|
ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 0*/) :
|
||||||
wxFlexGridSizer(3, 0, hgap),
|
wxFlexGridSizer(3, 0, hgap),
|
||||||
m_parent(parent),
|
|
||||||
m_hgap_unscaled((double)(hgap)/em_unit(parent))
|
m_hgap_unscaled((double)(hgap)/em_unit(parent))
|
||||||
{
|
{
|
||||||
SetFlexibleDirection(wxHORIZONTAL);
|
SetFlexibleDirection(wxHORIZONTAL);
|
||||||
|
@ -54,11 +54,6 @@ wxBitmapBundle* get_bmp_bundle(const std::string& bmp_name, int px_cnt = 16, con
|
|||||||
wxBitmapBundle* get_empty_bmp_bundle(int width, int height);
|
wxBitmapBundle* get_empty_bmp_bundle(int width, int height);
|
||||||
wxBitmapBundle* get_solid_bmp_bundle(int width, int height, const std::string& color);
|
wxBitmapBundle* get_solid_bmp_bundle(int width, int height, const std::string& color);
|
||||||
|
|
||||||
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
|
|
||||||
const int px_cnt = 16, const bool grayscale = false,
|
|
||||||
const std::string& new_color = std::string(), // color witch will used instead of orange
|
|
||||||
const bool menu_bitmap = false);
|
|
||||||
|
|
||||||
std::vector<wxBitmapBundle*> get_extruder_color_icons(bool thin_icon = false);
|
std::vector<wxBitmapBundle*> get_extruder_color_icons(bool thin_icon = false);
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -172,7 +167,6 @@ private:
|
|||||||
wxBitmap m_bitmap = wxBitmap();
|
wxBitmap m_bitmap = wxBitmap();
|
||||||
std::string m_icon_name = "";
|
std::string m_icon_name = "";
|
||||||
int m_px_cnt {16};
|
int m_px_cnt {16};
|
||||||
bool m_grayscale {false};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -338,7 +332,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<ModeButton*> m_mode_btns;
|
std::vector<ModeButton*> m_mode_btns;
|
||||||
wxWindow* m_parent {nullptr};
|
|
||||||
double m_hgap_unscaled;
|
double m_hgap_unscaled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind/bind.hpp>
|
||||||
|
|
||||||
using boost::optional;
|
using boost::optional;
|
||||||
using boost::system::error_code;
|
using boost::system::error_code;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <boost/asio/read_until.hpp>
|
#include <boost/asio/read_until.hpp>
|
||||||
#include <boost/asio/steady_timer.hpp>
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/asio/write.hpp>
|
#include <boost/asio/write.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind/bind.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
@ -41,7 +41,7 @@ void TCPConsole::transmit_next_command()
|
|||||||
boost::asio::async_write(
|
boost::asio::async_write(
|
||||||
m_socket,
|
m_socket,
|
||||||
boost::asio::buffer(m_send_buffer),
|
boost::asio::buffer(m_send_buffer),
|
||||||
boost::bind(&TCPConsole::handle_write, this, _1, _2)
|
boost::bind(&TCPConsole::handle_write, this, boost::placeholders::_1, boost::placeholders::_2)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ void TCPConsole::wait_next_line()
|
|||||||
m_socket,
|
m_socket,
|
||||||
m_recv_buffer,
|
m_recv_buffer,
|
||||||
m_newline,
|
m_newline,
|
||||||
boost::bind(&TCPConsole::handle_read, this, _1, _2)
|
boost::bind(&TCPConsole::handle_read, this, boost::placeholders::_1, boost::placeholders::_2)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ bool TCPConsole::run_queue()
|
|||||||
auto endpoints = m_resolver.resolve(m_host_name, m_port_name);
|
auto endpoints = m_resolver.resolve(m_host_name, m_port_name);
|
||||||
|
|
||||||
m_socket.async_connect(endpoints->endpoint(),
|
m_socket.async_connect(endpoints->endpoint(),
|
||||||
boost::bind(&TCPConsole::handle_connect, this, _1)
|
boost::bind(&TCPConsole::handle_connect, this, boost::placeholders::_1)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Loop until we get any reasonable result. Negative result is also result.
|
// Loop until we get any reasonable result. Negative result is also result.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user