#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
in vec2 vRad1;
in vec2 vRad2;
in float vFactor;
out vec2 cenPos;
out vec2 texPos;
out vec2 texDist;
out float factor;
const float root = 1 / sqrt(2) ;
void main() {
  factor = vFactor[0];
  rad1 = vRad1[0];
  rad2 = vRad2[0];
  cenPos = gl_in[0].gl_Position;
  vec2 g (vec2 p) { return vec2(dot(rad1,p), dot(rad2,p)); }

  texPos = vec2(1,1);
  texDist = g(root,root);
  gl_Position = vec4 (1,1,0,1);
  EmitVertex();
  texPos = vec2(1,0);
  texDist = g(root,-root);
  gl_Position = vec4 (1,-1,0,1);
  EmitVertex();
  texPos = vec2(0,1);
  texDist = g(-root,root);
  gl_Position = vec4 (-1,1,0,1);
  EmitVertex();
  texPos = vec2(0,0);
  texDist = g(-root,-root);
  gl_Position = vec4 (-1,-1,0,1);
  EmitVertex();
  EndPrimitive();
}
