Debian Codegraph @

qCC/shaders/DrawNormals/DrawNormals.gs

raw
1 #version 330 core
2 layout (points) in;
3 layout (line_strip, max_vertices = 2) out;
4
5 in Vertex
6 {
7 vec3 normal;
8 } vertex[];
9
10 uniform float normalLength;
11 uniform mat4 modelViewProjectionMatrix;
12
13
14 void main(void)
15 {
16 vec3 P = gl_in[0].gl_Position.xyz;
17 vec3 N = vertex[0].normal;
18
19 gl_Position = modelViewProjectionMatrix * vec4(P, 1.0);
20 EmitVertex();
21
22 gl_Position = modelViewProjectionMatrix * vec4(P + N * normalLength, 1);
23 EmitVertex();
24
25 EndPrimitive();
26 }