Add "cap" shadow shader

This commit is contained in:
2021-08-29 18:13:55 +01:00
parent d23f36ea95
commit eba8ff121c
12 changed files with 66 additions and 8 deletions
+19
View File
@@ -0,0 +1,19 @@
#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 {}
}