diff --git a/resources/shaders/gouraud_light.fs b/resources/shaders/gouraud_light.fs index 1a58abc85..d1bb2f55b 100644 --- a/resources/shaders/gouraud_light.fs +++ b/resources/shaders/gouraud_light.fs @@ -7,5 +7,5 @@ varying vec2 intensity; void main() { - gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + uniform_color.rgb * intensity.x, uniform_color.a); + gl_FragColor = vec4(vec3(intensity.y) + uniform_color.rgb * intensity.x, uniform_color.a); } diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 6cb78d2fa..5108c3b41 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1202,8 +1202,9 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin { Polygons convex_hulls_other; #if ENABLE_SEQUENTIAL_LIMITS + if (polygons != nullptr) + polygons->clear(); std::vector intersecting_idxs; - bool intersection_detected = false; #endif // ENABLE_SEQUENTIAL_LIMITS std::map map_model_object_to_convex_hull; @@ -1240,14 +1241,14 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin // Convert the shift from the PrintObject's coordinates into ModelObject's coordinates by removing the centering offset. convex_hull.translate(instance.shift - print_object->center_offset()); #if ENABLE_SEQUENTIAL_LIMITS + // if output needed, collect indices (inside convex_hulls_other) of intersecting hulls for (size_t i = 0; i < convex_hulls_other.size(); ++i) { if (!intersection((Polygons)convex_hulls_other[i], (Polygons)convex_hull).empty()) { if (polygons == nullptr) return false; else { - intersection_detected = true; - intersecting_idxs.push_back(i); - intersecting_idxs.push_back(convex_hulls_other.size()); + intersecting_idxs.emplace_back(i); + intersecting_idxs.emplace_back(convex_hulls_other.size()); } } } @@ -1260,15 +1261,13 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin } #if ENABLE_SEQUENTIAL_LIMITS - if (intersection_detected) { - assert(polygons != nullptr); - + if (!intersecting_idxs.empty()) { + // use collected indices (inside convex_hulls_other) to update output std::sort(intersecting_idxs.begin(), intersecting_idxs.end()); intersecting_idxs.erase(std::unique(intersecting_idxs.begin(), intersecting_idxs.end()), intersecting_idxs.end()); for (size_t i : intersecting_idxs) { polygons->emplace_back(std::move(convex_hulls_other[i])); } - return false; } #endif // ENABLE_SEQUENTIAL_LIMITS