Got generation of circular quads working.
This commit is contained in:
parent
b974508683
commit
086713341b
@ -4,17 +4,35 @@ uniform mat4 viewProjectionMatrix;
|
|||||||
uniform float time;
|
uniform float time;
|
||||||
|
|
||||||
layout(points) in;
|
layout(points) in;
|
||||||
layout(triangle_strip, max_vertices = 3) out;
|
layout(triangle_strip, max_vertices = 64) out;
|
||||||
|
|
||||||
|
const float PI = 3.1415926;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * vec4(-0.5, 0.0, 0.0, 0.0);
|
float resolution = 5.0;
|
||||||
|
for (int i = 0; i<resolution; i++) {
|
||||||
|
float leftAngle = PI * 2.0 / resolution * i;
|
||||||
|
float rightAngle = PI * 2.0 / resolution * (i+1);
|
||||||
|
float downRadius = 1.0;
|
||||||
|
float upRadius = 2.0;
|
||||||
|
|
||||||
|
vec4 offset = vec4(cos(leftAngle) * downRadius, 0.0, -sin(leftAngle) * downRadius, 0.0);
|
||||||
|
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||||
EmitVertex();
|
EmitVertex();
|
||||||
|
|
||||||
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * vec4(0.5, 0.0, 0.0, 0.0);
|
offset = vec4(cos(leftAngle) * upRadius, 1.0, -sin(leftAngle) * upRadius, 0.0);
|
||||||
|
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||||
EmitVertex();
|
EmitVertex();
|
||||||
|
|
||||||
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * vec4(0.0, 2.0 + sin(time), 0.0, 0.0);
|
offset = vec4(cos(rightAngle) * downRadius, 0.0, -sin(rightAngle) * downRadius, 0.0);
|
||||||
|
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||||
|
EmitVertex();
|
||||||
|
|
||||||
|
offset = vec4(cos(rightAngle) * upRadius, 1.0, -sin(rightAngle) * upRadius, 0.0);
|
||||||
|
gl_Position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||||
EmitVertex();
|
EmitVertex();
|
||||||
|
|
||||||
EndPrimitive();
|
EndPrimitive();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user