Invert colors at lowest print height.

Instead of inverting them if below 0 (build-plate). Fixes #8735

CURA-7871
This commit is contained in:
Remco Burema 2020-11-20 12:32:58 +01:00
parent 39acad87d9
commit 2837640315
No known key found for this signature in database
GPG key ID: 215C49431D43F98C
3 changed files with 35 additions and 8 deletions

View file

@ -32,6 +32,7 @@ fragment =
uniform lowp float u_overhangAngle;
uniform lowp vec4 u_overhangColor;
uniform lowp float u_lowestPrintableHeight;
uniform lowp vec4 u_faceColor;
uniform highp int u_faceId;
@ -65,7 +66,7 @@ fragment =
highp vec3 grid = vec3(f_vertex.x - floor(f_vertex.x - 0.5), f_vertex.y - floor(f_vertex.y - 0.5), f_vertex.z - floor(f_vertex.z - 0.5));
finalColor.a = (u_renderError > 0.5) && dot(grid, grid) < 0.245 ? 0.667 : 1.0;
if (f_vertex.y <= 0.0)
if (f_vertex.y <= u_lowestPrintableHeight)
{
finalColor.rgb = vec3(1.0, 1.0, 1.0) - finalColor.rgb;
}
@ -109,6 +110,7 @@ fragment41core =
uniform lowp float u_overhangAngle;
uniform lowp vec4 u_overhangColor;
uniform lowp float u_lowestPrintableHeight;
uniform lowp vec4 u_faceColor;
uniform highp int u_faceId;
@ -141,7 +143,7 @@ fragment41core =
finalColor = (u_faceId != gl_PrimitiveID) ? ((f_vertex.y > 0.0001 && -normal.y > u_overhangAngle) ? u_overhangColor : finalColor) : u_faceColor;
frag_color = finalColor;
if (f_vertex.y <= 0.0)
if (f_vertex.y <= u_lowestPrintableHeight)
{
frag_color.rgb = vec3(1.0, 1.0, 1.0) - frag_color.rgb;
}
@ -157,6 +159,7 @@ u_overhangColor = [1.0, 0.0, 0.0, 1.0]
u_faceColor = [0.0, 0.0, 1.0, 1.0]
u_shininess = 20.0
u_renderError = 1.0
u_lowestPrintableHeight = 0.0
[bindings]
u_modelMatrix = model_matrix

View file

@ -36,6 +36,7 @@ fragment =
uniform mediump float u_width;
uniform bool u_vertical_stripes;
uniform lowp u_lowestPrintableHeight;
varying highp vec3 v_position;
varying highp vec3 v_vertex;
@ -64,7 +65,7 @@ fragment =
highp vec3 viewVector = normalize(u_viewPosition - v_vertex);
highp float NdotR = clamp(dot(viewVector, reflectedLight), 0.0, 1.0);
finalColor += pow(NdotR, u_shininess) * u_specularColor;
if (v_vertex.y <= 0.0)
if (v_vertex.y <= u_lowestPrintableHeight)
{
finalColor.rgb = vec3(1.0, 1.0, 1.0) - finalColor.rgb;
}
@ -112,6 +113,7 @@ fragment41core =
uniform mediump float u_width;
uniform mediump bool u_vertical_stripes;
uniform lowp float u_lowestPrintableHeight;
in highp vec3 v_position;
in highp vec3 v_vertex;
@ -144,7 +146,7 @@ fragment41core =
finalColor += pow(NdotR, u_shininess) * u_specularColor;
frag_color = finalColor;
if (v_vertex.y <= 0.0)
if (v_vertex.y <= u_lowestPrintableHeight)
{
frag_color.rgb = vec3(1.0, 1.0, 1.0) - frag_color.rgb;
}
@ -160,6 +162,7 @@ u_opacity = 1.0
u_shininess = 20.0
u_width = 5.0
u_vertical_stripes = 0
u_lowestPrintableHeight = 0.0
[bindings]
u_modelMatrix = model_matrix