Slight improvement to light sources and shadows

This commit is contained in:
jgk
2021-02-23 13:14:23 +01:00
parent e855d303e8
commit 5bdd646900
5 changed files with 34 additions and 21 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ void main()
vec2 pos = gl_FragCoord.xy;
float dist = min(1 , 2*distance(pos,cenPosT) / (gParams.x));
//float c = pow(gParams.y*dist,2);
float c = pow(1-dist,2);
float c = gParams.y * pow(1-dist,2);
fColor = vec4( c,c,c ,c );
// fColor = vec4( 1,0,0 , 1);
// fColor = vec4( 1,0,0 , pow(dist,2) );
+12 -12
View File
@@ -12,18 +12,18 @@ void main()
vec2 posc = vBackPoss[0].xy;
vec2 posd = vBackPoss[0].zw;
gl_Position = vec4 (posa, 0 , 1);
EmitVertex();
gl_Position = vec4 (posa + (200 * (posa - lightPos)), 0 , 1);
EmitVertex();
gl_Position = vec4 (posb, 0 , 1);
EmitVertex();
gl_Position = vec4 (posb + (200 * (posb - lightPos)), 0 , 1);
EmitVertex();
gl_Position = vec4 (posb + (200 * (posb - lightPos)), 0 , 1);
EmitVertex();
gl_Position = vec4 (posd, 0 , 1);
EmitVertex();
// gl_Position = vec4 (posa, 0 , 1);
// EmitVertex();
// gl_Position = vec4 (posa + (200 * (posa - lightPos)), 0 , 1);
// EmitVertex();
// gl_Position = vec4 (posb, 0 , 1);
// EmitVertex();
// gl_Position = vec4 (posb + (200 * (posb - lightPos)), 0 , 1);
// EmitVertex();
// gl_Position = vec4 (posb + (200 * (posb - lightPos)), 0 , 1);
// EmitVertex();
// gl_Position = vec4 (posd, 0 , 1);
// EmitVertex();
gl_Position = vec4 (posd, 0 , 1);
EmitVertex();
gl_Position = vec4 (posd + (200 * (posd - lightPos)), 0 , 1);