wireframe2d.vertex.fx 824 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // based on if Instanced Array are supported or not, declare the field either as attribute or uniform
  2. #ifdef Instanced
  3. #define att attribute
  4. #else
  5. #define att uniform
  6. #endif
  7. // Attributes
  8. attribute vec2 pos;
  9. attribute vec4 col;
  10. // x, y, z are
  11. // x : alignedToPixel: 1.0 === yes, otherwise no
  12. // y : 1/renderGroup.Width
  13. // z : 1/renderGroup.height
  14. att vec3 properties;
  15. att vec2 zBias;
  16. att vec4 transformX;
  17. att vec4 transformY;
  18. att float opacity;
  19. // Uniforms
  20. // Output
  21. varying vec4 vColor;
  22. void main(void) {
  23. vec4 p = vec4(pos.xy, 1.0, 1.0);
  24. vColor = vec4(col.xyz, col.w*opacity);
  25. vec4 pp = vec4(dot(p, transformX), dot(p, transformY), zBias.x, 1);
  26. if (properties.x == 1.0) {
  27. pp.xy = pp.xy - mod(pp.xy, properties.yz) + (properties.yz*0.5);
  28. }
  29. gl_Position = pp;
  30. }