layers.shader 839 B

1234567891011121314151617181920212223242526272829303132333435
  1. [shaders]
  2. vertex =
  3. uniform highp mat4 u_modelViewProjectionMatrix;
  4. uniform lowp float u_active_extruder;
  5. uniform lowp float u_shade_factor;
  6. attribute highp vec4 a_vertex;
  7. attribute lowp vec4 a_color;
  8. varying lowp vec4 v_color;
  9. void main()
  10. {
  11. gl_Position = u_modelViewProjectionMatrix * a_vertex;
  12. // shade the color depending on the extruder index stored in the alpha component of the color
  13. v_color = (a_color.a == u_active_extruder) ? a_color : a_color * u_shade_factor;
  14. v_color.a = 1.0;
  15. }
  16. fragment =
  17. varying lowp vec4 v_color;
  18. void main()
  19. {
  20. gl_FragColor = v_color;
  21. }
  22. [defaults]
  23. u_active_extruder = 0.0
  24. u_shade_factor = 0.60
  25. [bindings]
  26. u_modelViewProjectionMatrix = model_view_projection_matrix
  27. [attributes]
  28. a_vertex = vertex
  29. a_color = color