mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fixed some opengl 4.1 core vertex and fragment shaders, layerview anchor. CURA-3273
This commit is contained in:
parent
4bb8e1b025
commit
4659d8616e
3 changed files with 92 additions and 2 deletions
|
@ -174,7 +174,7 @@ Item
|
|||
ComboBox
|
||||
{
|
||||
id: layerTypeCombobox
|
||||
anchors.top: slider_background.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
model: layerViewTypes
|
||||
visible: !UM.LayerView.compatibilityMode
|
||||
|
@ -186,7 +186,7 @@ Item
|
|||
Label
|
||||
{
|
||||
id: compatibilityModeLabel
|
||||
anchors.top: slider_background.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
text: catalog.i18nc("@label","Compatibility mode")
|
||||
visible: UM.LayerView.compatibilityMode
|
||||
|
|
|
@ -63,6 +63,74 @@ fragment =
|
|||
}
|
||||
}
|
||||
|
||||
vertex41core =
|
||||
#version 410
|
||||
uniform highp mat4 u_modelViewProjectionMatrix;
|
||||
in highp vec4 a_vertex;
|
||||
in highp vec2 a_uvs;
|
||||
|
||||
out highp vec2 v_uvs;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_modelViewProjectionMatrix * a_vertex;
|
||||
v_uvs = a_uvs;
|
||||
}
|
||||
|
||||
fragment41core =
|
||||
#version 410
|
||||
uniform sampler2D u_layer0;
|
||||
uniform sampler2D u_layer1;
|
||||
uniform sampler2D u_layer2;
|
||||
|
||||
uniform vec2 u_offset[9];
|
||||
|
||||
uniform vec4 u_background_color;
|
||||
uniform float u_outline_strength;
|
||||
uniform vec4 u_outline_color;
|
||||
|
||||
in vec2 v_uvs;
|
||||
|
||||
float kernel[9];
|
||||
|
||||
const vec3 x_axis = vec3(1.0, 0.0, 0.0);
|
||||
const vec3 y_axis = vec3(0.0, 1.0, 0.0);
|
||||
const vec3 z_axis = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
kernel[0] = 0.0; kernel[1] = 1.0; kernel[2] = 0.0;
|
||||
kernel[3] = 1.0; kernel[4] = -4.0; kernel[5] = 1.0;
|
||||
kernel[6] = 0.0; kernel[7] = 1.0; kernel[8] = 0.0;
|
||||
|
||||
vec4 result = u_background_color;
|
||||
|
||||
vec4 main_layer = texture(u_layer0, v_uvs);
|
||||
vec4 selection_layer = texture(u_layer1, v_uvs);
|
||||
vec4 layerview_layer = texture(u_layer2, v_uvs);
|
||||
|
||||
result = main_layer * main_layer.a + result * (1.0 - main_layer.a);
|
||||
result = layerview_layer * layerview_layer.a + result * (1.0 - layerview_layer.a);
|
||||
|
||||
vec4 sum = vec4(0.0);
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
vec4 color = vec4(texture(u_layer1, v_uvs.xy + u_offset[i]).a);
|
||||
sum += color * (kernel[i] / u_outline_strength);
|
||||
}
|
||||
|
||||
if((selection_layer.rgb == x_axis || selection_layer.rgb == y_axis || selection_layer.rgb == z_axis))
|
||||
{
|
||||
frag_color = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
frag_color = mix(result, u_outline_color, abs(sum.a));
|
||||
}
|
||||
}
|
||||
|
||||
[defaults]
|
||||
u_layer0 = 0
|
||||
u_layer1 = 1
|
||||
|
|
|
@ -17,6 +17,28 @@ fragment =
|
|||
gl_FragColor = u_color;
|
||||
}
|
||||
|
||||
vertex41core =
|
||||
#version 410
|
||||
uniform highp mat4 u_modelViewProjectionMatrix;
|
||||
|
||||
in highp vec4 a_vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_modelViewProjectionMatrix * a_vertex;
|
||||
}
|
||||
|
||||
fragment41core =
|
||||
#version 410
|
||||
uniform lowp vec4 u_color;
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = u_color;
|
||||
}
|
||||
|
||||
[defaults]
|
||||
u_color = [0.02, 0.02, 0.02, 1.0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue