Move multiplication from Python to shaders. (Needs the same-named Uranium branch.)

This commit is contained in:
Remco Burema 2019-04-19 16:58:38 +02:00
parent 9daa78a98f
commit ed6db6c9b0
10 changed files with 186 additions and 130 deletions

View file

@ -1,6 +1,9 @@
[shaders]
vertex =
uniform highp mat4 u_modelViewProjectionMatrix;
uniform highp mat4 u_modelMatrix;
uniform highp mat4 u_viewMatrix;
uniform highp mat4 u_projectionMatrix;
uniform lowp float u_active_extruder;
uniform lowp float u_shade_factor;
uniform highp int u_layer_view_type;
@ -16,7 +19,7 @@ vertex =
void main()
{
gl_Position = u_modelViewProjectionMatrix * a_vertex;
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
// shade the color depending on the extruder index
v_color = vec4(0.4, 0.4, 0.4, 0.9); // default color for not current layer;
// 8 and 9 are travel moves
@ -80,7 +83,10 @@ fragment =
vertex41core =
#version 410
uniform highp mat4 u_modelViewProjectionMatrix;
uniform highp mat4 u_modelMatrix;
uniform highp mat4 u_viewMatrix;
uniform highp mat4 u_projectionMatrix;
uniform lowp float u_active_extruder;
uniform lowp float u_shade_factor;
uniform highp int u_layer_view_type;
@ -96,7 +102,7 @@ vertex41core =
void main()
{
gl_Position = u_modelViewProjectionMatrix * a_vertex;
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
v_color = vec4(0.4, 0.4, 0.4, 0.9); // default color for not current layer
// if ((a_line_type != 8) && (a_line_type != 9)) {
// v_color = (a_extruder == u_active_extruder) ? v_color : vec4(u_shade_factor * v_color.rgb, v_color.a);
@ -159,7 +165,9 @@ u_show_skin = 1
u_show_infill = 1
[bindings]
u_modelViewProjectionMatrix = model_view_projection_matrix
u_modelMatrix = model_matrix
u_viewMatrix = view_matrix
u_projectionMatrix = projection_matrix
[attributes]
a_vertex = vertex