Prevent drawing of shadow caps when turned off

This commit is contained in:
2023-03-25 17:46:54 +00:00
parent d989acd6f2
commit 3dd386e908
3 changed files with 38 additions and 25 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
layout(location=0)uniform vec3 lightPos;
in float drawbit[];
// this code is duplicated in lineShadow.geom, should not be changed on its own
vec4 projNear (vec4 pos)
{
@@ -20,7 +21,8 @@ void main()
vec4 p2 = gl_in[2].gl_Position ;
if ( //if Light Source is below all vertices, draw cap
// TODO think about when LS is beside the object
( p0.z - lightPos.z > 0 )
(drawbit[0] == 1)
&& ( p0.z - lightPos.z > 0 )
&& ( p1.z - lightPos.z > 0 )
&& ( p2.z - lightPos.z > 0 )
)
+4 -4
View File
@@ -1,11 +1,11 @@
#version 450 core
layout (location = 0) in vec3 position;
layout (location = 0) in vec4 position;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
uniform vec4 lumRad;
out vec3 dField;
out vec3 lum;
out float drawbit;
void main()
{
gl_Position = vec4(position,1);
gl_Position = vec4(position.xyz,1);
drawbit = position.w;
}