Files
loop/shader/lighting/cap.geom
T
2021-08-29 18:13:55 +01:00

20 lines
567 B
GLSL

#version 430 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
void main()
{
vec4 p0 = gl_in[0].gl_Position ;
vec4 p1 = gl_in[1].gl_Position ;
vec4 p2 = gl_in[2].gl_Position ;
if ( dot( lightPos, cross( p0.xyz - p1.xyz, p1.xyz - p2.xyz)) < 0)
{
gl_Position = theMat * p0; EmitVertex();
gl_Position = theMat * p1; EmitVertex();
gl_Position = theMat * p2; EmitVertex();
EndPrimitive();
}
else {}
}