mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 22:23:57 -06:00

Somewhere between the xray.shader and the xray_composite.shader the colors are stored as unsigned int. Since we want to count the integer number of faces behind a pixel in the red channel, we simply use a color with an r value of 1/255.
54 lines
1 KiB
GLSL
54 lines
1 KiB
GLSL
[shaders]
|
|
vertex =
|
|
uniform highp mat4 u_modelMatrix;
|
|
uniform highp mat4 u_viewMatrix;
|
|
uniform highp mat4 u_projectionMatrix;
|
|
|
|
attribute highp vec4 a_vertex;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
|
}
|
|
|
|
fragment =
|
|
const lowp vec4 u_color = vec4(1.0 / 255.0, 0.0, 0.0, 1.0);
|
|
|
|
void main()
|
|
{
|
|
gl_FragColor = u_color;
|
|
}
|
|
|
|
vertex41core =
|
|
#version 410
|
|
uniform highp mat4 u_modelMatrix;
|
|
uniform highp mat4 u_viewMatrix;
|
|
uniform highp mat4 u_projectionMatrix;
|
|
|
|
in highp vec4 a_vertex;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
|
}
|
|
|
|
fragment41core =
|
|
#version 410
|
|
const lowp vec4 u_color = vec4(1.0 / 255.0, 0.0, 0.0, 1.0);
|
|
|
|
out vec4 frag_color;
|
|
|
|
void main()
|
|
{
|
|
frag_color = u_color;
|
|
}
|
|
|
|
[defaults]
|
|
|
|
[bindings]
|
|
u_modelMatrix = model_matrix
|
|
u_viewMatrix = view_matrix
|
|
u_projectionMatrix = projection_matrix
|
|
|
|
[attributes]
|
|
a_vertex = vertex
|