-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.geom
50 lines (36 loc) · 1.02 KB
/
test.geom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
in vec3 worldPos[];
in vec4 color[];
varying vec4 colorOut;
varying vec4 TexCoord;
void constructFan(int index,
vec2 size)
{
vec3 LL = worldPos[index] + vec3(-size/2.0, 0.0);
vec3 LR = worldPos[index] + vec3(size.x/2.0, -size.y/2.0, 0.0);
vec3 UR = worldPos[index] + vec3(size/2.0, 0.0);
vec3 UL = worldPos[index] + vec3(-size.x/2.0, size.y/2.0, 0.0);
gl_Position = vec4(LL, 1.0);
TexCoord = vec4(0.0, 0.0, 0.0, 1.0);
EmitVertex();
gl_Position = vec4(UL, 1.0);
TexCoord = vec4(0.0, 1.0, 0.0, 1.0);
EmitVertex();
gl_Position = vec4(LR, 1.0);
TexCoord = vec4(1.0, 0.0, 0.0, 1.0);
EmitVertex();
gl_Position = vec4(UR, 1.0);
TexCoord = vec4(1.0, 1.0, 0.0, 1.0);
EmitVertex();
EndPrimitive();
}
// Main entry point
void main()
{
colorOut = color[0];
constructFan(0, vec2(0.051, 0.051));
//gl_Position = vec4(worldPos[0], 1.0);
//EmitVertex();
EndPrimitive();
}