Continue work on shadow rendering

This commit is contained in:
2023-03-14 11:20:38 +00:00
parent 9947979b52
commit 6af041bb8c
20 changed files with 417 additions and 380 deletions
+13
View File
@@ -13,6 +13,19 @@ vec4 shift(vec4 p) { return vec4(p.xy + (200 * (p.xy - lightPos.xy)), 0, 1); }
float isLHS(vec2 startV, vec2 testV) {
return sign(-startV.x * testV.y + startV.y * testV.x);
}
// Preprocessed to include ../functions.glsl
float closestPointOnLineParam (vec2 a, vec2 b, vec2 p) {
return dot(p - a,b-a) / dot(b-a,b-a);
}
vec2 closestPointOnSeg (vec2 a,vec2 b, vec2 p) {
float x = closestPointOnLineParam(a,b,p);
if (x < 0) {
return a;
} else{ if (x > 1) { return b; }
{ return a + (x * (b- a));}
}
}
// End include 2023-03-13 15:33:44.454374887 UTC
// 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);