mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-17 22:05:55 +08:00
Port of the changes made with 5e0590a93e852c532fb0ff59a72463c318c119e0 and 0995cfc658dfbfdbc61fde451d32d06a9195b9a7 to OpenGL ES
This commit is contained in:
parent
aa468b3770
commit
eba735d785
@ -29,8 +29,6 @@ struct SlopeDetection
|
||||
uniform vec4 uniform_color;
|
||||
uniform SlopeDetection slope;
|
||||
|
||||
uniform bool offset_depth_buffer;
|
||||
|
||||
#ifdef ENABLE_ENVIRONMENT_MAP
|
||||
uniform sampler2D environment_tex;
|
||||
uniform bool use_environment_tex;
|
||||
@ -81,9 +79,4 @@ void main()
|
||||
else
|
||||
#endif
|
||||
gl_FragColor = vec4(vec3(intensity.y) + color * intensity.x, alpha);
|
||||
|
||||
// In the support painting gizmo and the seam painting gizmo are painted triangles rendered over the already
|
||||
// rendered object. To resolved z-fighting between previously rendered object and painted triangles, values
|
||||
// inside the depth buffer are offset by small epsilon for painted triangles inside those gizmos.
|
||||
gl_FragDepth = gl_FragCoord.z - (offset_depth_buffer ? EPSILON : 0.0);
|
||||
}
|
||||
|
@ -3,14 +3,9 @@
|
||||
|
||||
precision highp float;
|
||||
|
||||
const float EPSILON = 0.0001;
|
||||
|
||||
uniform vec4 uniform_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = uniform_color;
|
||||
// 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;
|
||||
}
|
||||
|
@ -7,5 +7,8 @@ attribute vec3 v_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
|
||||
// Add small epsilon to z to solve z-fighting between painted triangles and contour lines.
|
||||
vec4 clip_position = projection_matrix * view_model_matrix * vec4(v_position, 1.0);
|
||||
clip_position.z -= 0.00001 * abs(clip_position.w);
|
||||
gl_Position = clip_position;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user