stk-code_catmod/data/shaders/normal_visualizer.geom

22 lines
470 B
Plaintext
Raw Normal View History

layout(triangles) in;
layout(line_strip, max_vertices = 6) out;
in vec3 nor[];
void main()
{
for(int i=0; i < gl_in.length(); i++)
{
vec4 pos = gl_in[i].gl_Position;
gl_Position = pos;
EmitVertex();
2014-08-09 15:24:50 -04:00
vec3 normal = normalize(nor[i]);
2014-08-09 15:19:26 -04:00
pos = inverse(ProjectionMatrix) * pos;
pos /= pos.w;
gl_Position = ProjectionMatrix * (pos + .2 * vec4(normal, 0.));
EmitVertex();
EndPrimitive();
}
}