stk-code_catmod/data/shaders/sp_normal_visualizer.geom

23 lines
470 B
Plaintext
Raw Normal View History

layout(triangles) in;
layout(line_strip, max_vertices = 6) out;
in vec3 normal[];
void main()
{
for (int i = 0; i < gl_in.length(); i++)
{
vec4 pos = gl_in[i].gl_Position;
gl_Position = pos;
EmitVertex();
pos = inverse(u_projection_matrix) * pos;
pos /= pos.w;
gl_Position = u_projection_matrix *
(pos + 0.2 * vec4(normalize(normal[i]), 0.0));
EmitVertex();
EndPrimitive();
}
}