advanced-aa.vs 756 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #version 150
  2. in vec4 position;
  3. in vec2 texCoord;
  4. uniform vec4 sourceSize[];
  5. in vec2 ps;
  6. in float dx;
  7. in float dy;
  8. out Vertex {
  9. vec2 texCoord;
  10. vec4 t1;
  11. vec4 t2;
  12. vec4 t3;
  13. vec4 t4;
  14. } vertexOut;
  15. void main() {
  16. vec2 ps = vec2(1.0/sourceSize[0].x, 1.0/sourceSize[0].y);
  17. float dx = ps.x * 0.5;
  18. float dy = ps.y * 0.5;
  19. gl_Position = position;
  20. vertexOut.texCoord = texCoord;
  21. vertexOut.t1.xy = texCoord + vec2(-dx, 0);
  22. vertexOut.t2.xy = texCoord + vec2( dx, 0);
  23. vertexOut.t3.xy = texCoord + vec2( 0, -dy);
  24. vertexOut.t4.xy = texCoord + vec2( 0, dy);
  25. vertexOut.t1.zw = texCoord + vec2(-dx, -dy);
  26. vertexOut.t2.zw = texCoord + vec2(-dx, dy);
  27. vertexOut.t3.zw = texCoord + vec2( dx, -dy);
  28. vertexOut.t4.zw = texCoord + vec2( dx, dy);
  29. }