Tech ENABLE_SEQUENTIAL_LIMITS -> Fixed z-fighting between sequential print clearance regions and objects
This commit is contained in:
parent
2cf5f83bb6
commit
b014e87ef7
1 changed files with 2 additions and 2 deletions
|
@ -813,7 +813,7 @@ void GLCanvas3D::SequentialPrintClearance::set(const Polygons& polygons)
|
||||||
for (const ExPolygon& poly : polygons_union) {
|
for (const ExPolygon& poly : polygons_union) {
|
||||||
std::vector<Vec3d> triangulation = triangulate_expolygon_3d(poly, false);
|
std::vector<Vec3d> triangulation = triangulate_expolygon_3d(poly, false);
|
||||||
for (const Vec3d& v : triangulation) {
|
for (const Vec3d& v : triangulation) {
|
||||||
entity.positions.emplace_back(v.cast<float>());
|
entity.positions.emplace_back(v.cast<float>() + Vec3f(0.0f, 0.0f, 0.0125)); // add a small positive z to avoid z-fighting
|
||||||
entity.normals.emplace_back(Vec3f::UnitZ());
|
entity.normals.emplace_back(Vec3f::UnitZ());
|
||||||
size_t positions_count = entity.positions.size();
|
size_t positions_count = entity.positions.size();
|
||||||
if (positions_count % 3 == 0) {
|
if (positions_count % 3 == 0) {
|
||||||
|
@ -836,7 +836,7 @@ void GLCanvas3D::SequentialPrintClearance::set(const Polygons& polygons)
|
||||||
ent.indices.reserve(poly.points.size());
|
ent.indices.reserve(poly.points.size());
|
||||||
unsigned int id_count = 0;
|
unsigned int id_count = 0;
|
||||||
for (const Point& p : poly.points) {
|
for (const Point& p : poly.points) {
|
||||||
ent.positions.emplace_back(unscale<float>(p.x()), unscale<float>(p.y()), 0.025f);
|
ent.positions.emplace_back(unscale<float>(p.x()), unscale<float>(p.y()), 0.025f); // add a small positive z to avoid z-fighting
|
||||||
ent.normals.emplace_back(Vec3f::UnitZ());
|
ent.normals.emplace_back(Vec3f::UnitZ());
|
||||||
ent.indices.emplace_back(id_count++);
|
ent.indices.emplace_back(id_count++);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue