Add line shadow shader

This commit is contained in:
2021-06-26 22:20:41 +02:00
parent 726cd425f2
commit 06f22a3ea5
21 changed files with 128 additions and 74 deletions
+7 -7
View File
@@ -5,7 +5,7 @@ layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
vec4 shift (vec4 p)
{ return vec4 (p.xy + (200 * (p.xy-lightPos.xy)), 0.1 , 1);
{ return vec4 (p.xy + (200 * (p.xy-lightPos.xy)), (-1) , 1);
}
float isLHS (vec2 startV, vec2 testV)
{
@@ -14,16 +14,16 @@ float isLHS (vec2 startV, vec2 testV)
// construct a box with openings on bottom face and face away from wall
void main()
{
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0.1,1);
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0.1,1);
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1);
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
if (isLHS (p1.xy - lightPos.xy, p2.xy - lightPos.xy) < 0)
{
vec4 p3 = vec4 (p1.xy,-0.5,1);
vec4 p4 = vec4 (p2.xy,-0.5,1);
vec4 p3 = vec4 (p1.xy,100,1);
vec4 p4 = vec4 (p2.xy,100,1);
vec4 p5 = shift(p1);
vec4 p6 = shift(p2);
vec4 p7 = vec4 (p6.xy,-0.5,1);
vec4 p8 = vec4 (p5.xy,-0.5,1);
vec4 p7 = vec4 (p6.xy,100,1);
vec4 p8 = vec4 (p5.xy,100,1);
vec4 a1 = theMat * p1;
vec4 a2 = theMat * p2;