• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2layout (location = 1) noperspective out vec2 vcoord_Stage0;
3void main() {
4    int x = gl_InstanceID % 200;
5    int y = gl_InstanceID / 200;
6    int ileft = (gl_InstanceID * 929) % 17;
7    int iright = (ileft + 1) + (gl_InstanceID * 1637) % (17 - ileft);
8    int itop = (gl_InstanceID * 313) % 17;
9    int ibot = (itop + 1) + (gl_InstanceID * 1901) % (17 - itop);
10    float outset = 0.03125;
11    outset = 0 == (x + y) % 2 ? -outset : outset;
12    float l = float(ileft) / 16.0 - outset;
13    float r = float(iright) / 16.0 + outset;
14    float t = float(itop) / 16.0 - outset;
15    float b = float(ibot) / 16.0 + outset;
16    vec2 vertexpos;
17    vertexpos.x = float(x) + (0 == gl_VertexID % 2 ? l : r);
18    vertexpos.y = float(y) + (0 == gl_VertexID / 2 ? t : b);
19    vcoord_Stage0.x = float(0 == gl_VertexID % 2 ? -1 : 1);
20    vcoord_Stage0.y = float(0 == gl_VertexID / 2 ? -1 : 1);
21    gl_Position = vec4(vertexpos.x, vertexpos.y, 0.0, 1.0);
22}
23