mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 17:48:59 +08:00
Reduce branches in shader.
part of the further fallout of CURA-7147
This commit is contained in:
parent
7ed59503d6
commit
d078c465ee
@ -68,11 +68,9 @@ fragment =
|
|||||||
|
|
||||||
finalColor = (-normal.y > u_overhangAngle) ? u_overhangColor : finalColor;
|
finalColor = (-normal.y > u_overhangAngle) ? u_overhangColor : finalColor;
|
||||||
|
|
||||||
if(u_renderError > 0.5)
|
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;
|
||||||
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 = dot(grid, grid) < 0.245 ? 0.667 : 1.0;
|
|
||||||
}
|
|
||||||
gl_FragColor = finalColor;
|
gl_FragColor = finalColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,11 +142,8 @@ fragment41core =
|
|||||||
finalColor = (u_faceId != gl_PrimitiveID) ? ((-normal.y > u_overhangAngle) ? u_overhangColor : finalColor) : u_faceColor;
|
finalColor = (u_faceId != gl_PrimitiveID) ? ((-normal.y > u_overhangAngle) ? u_overhangColor : finalColor) : u_faceColor;
|
||||||
|
|
||||||
frag_color = finalColor;
|
frag_color = finalColor;
|
||||||
if(u_renderError > 0.5)
|
vec3 grid = f_vertex - round(f_vertex);
|
||||||
{
|
frag_color.a = (u_renderError > 0.5) && dot(grid, grid) < 0.245 ? 0.667 : 1.0;
|
||||||
vec3 grid = f_vertex - round(f_vertex);
|
|
||||||
frag_color.a = dot(grid, grid) < 0.245 ? 0.667 : 1.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user