Add alternate shadow volume rendering pathway (layered geo)

This commit is contained in:
2023-03-12 09:29:36 +00:00
parent 184df01ff8
commit b88a8d5776
7 changed files with 52 additions and 53 deletions
+5 -2
View File
@@ -1,5 +1,6 @@
#version 450 core
layout (triangles) in;
layout (invocations = 20) in;
layout (triangle_strip, max_vertices = 3) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout (std140, binding = 1) uniform LightsBlock
@@ -7,8 +8,7 @@ layout (std140, binding = 1) uniform LightsBlock
vec4 posBool[20];
vec4 colRad[20];
} ;
uniform int lightID;
vec3 lightPos = posBool[lightID].xyz ;
vec3 lightPos = posBool[gl_InvocationID].xyz ;
float theBool = posBool[gl_InvocationID].w;
// this code is duplicated in lineShadow.geom, should not be changed on its own
vec4 projNear (vec4 pos)
@@ -35,8 +35,11 @@ void main()
{
// the front cap
vec4 v1 = vec4 (0,0,1,0) ;
gl_Layer = gl_InvocationID;
gl_Position = theMat * projNear(p0); EmitVertex();
gl_Layer = gl_InvocationID;
gl_Position = theMat * projNear(p1); EmitVertex();
gl_Layer = gl_InvocationID;
gl_Position = theMat * projNear(p2); EmitVertex();
EndPrimitive();
}