This commit is contained in:
Filip Sykala 2021-08-26 14:21:59 +02:00
commit f90b10b63e
3 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,11 @@
#version 110 #version 110
const float EPSILON = 0.0001;
void main() void main()
{ {
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
// Values inside depth buffer for fragments of the contour of a selected area are offset
// by small epsilon to solve z-fighting between painted triangles and contour lines.
gl_FragDepth = gl_FragCoord.z - EPSILON;
} }

View File

@ -630,7 +630,11 @@ void TriangleSelectorMmGui::render(ImGuiWrapper *imgui)
auto *contour_shader = wxGetApp().get_shader("mm_contour"); auto *contour_shader = wxGetApp().get_shader("mm_contour");
contour_shader->start_using(); contour_shader->start_using();
glsafe(::glDepthFunc(GL_LEQUAL));
m_gizmo_scene.render_contour(); m_gizmo_scene.render_contour();
glsafe(::glDepthFunc(GL_LESS));
contour_shader->stop_using(); contour_shader->stop_using();
} }
@ -725,10 +729,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
assert(this->vertices_VBO_id != 0); assert(this->vertices_VBO_id != 0);
assert(this->triangle_indices_VBO_ids[triangle_indices_idx] != 0); assert(this->triangle_indices_VBO_ids[triangle_indices_idx] != 0);
ScopeGuard offset_fill_guard([]() { glsafe(::glDisable(GL_POLYGON_OFFSET_FILL)); });
glsafe(::glEnable(GL_POLYGON_OFFSET_FILL));
glsafe(::glPolygonOffset(5.0, 5.0));
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id));
glsafe(::glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), (const void*)(0 * sizeof(float)))); glsafe(::glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), (const void*)(0 * sizeof(float))));

View File

@ -2915,6 +2915,7 @@ void Plater::priv::update_print_volume_state()
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(this->config->opt<ConfigOptionPoints>("bed_shape")->values)); BoundingBox bed_box_2D = get_extents(Polygon::new_scale(this->config->opt<ConfigOptionPoints>("bed_shape")->values));
BoundingBoxf3 print_volume(unscale(bed_box_2D.min(0), bed_box_2D.min(1), 0.0), unscale(bed_box_2D.max(0), bed_box_2D.max(1), scale_(this->config->opt_float("max_print_height")))); BoundingBoxf3 print_volume(unscale(bed_box_2D.min(0), bed_box_2D.min(1), 0.0), unscale(bed_box_2D.max(0), bed_box_2D.max(1), scale_(this->config->opt_float("max_print_height"))));
// Allow the objects to protrude below the print bed, only the part of the object above the print bed will be sliced. // Allow the objects to protrude below the print bed, only the part of the object above the print bed will be sliced.
print_volume.offset(BedEpsilon);
print_volume.min(2) = -1e10; print_volume.min(2) = -1e10;
this->q->model().update_print_volume_state(print_volume); this->q->model().update_print_volume_state(print_volume);
} }