Cleanup
This commit is contained in:
@@ -12,9 +12,7 @@ vec3 closestPointOnSeg3 (vec3 a,vec3 b, vec3 p) {
|
||||
float x = closestPointOnLineParam3(a,b,p);
|
||||
if (x < 0) {
|
||||
return a;
|
||||
} else{ if (x > 1) { return b; }
|
||||
{ return a + (x * (b- a));}
|
||||
}
|
||||
} else{ return (x > 1 ? b: a + (x * (b- a))); }
|
||||
}
|
||||
vec4 shift(vec4 p) { return (vec4(p.xyz + (10000 * (p.xyz - lightPos)), 1)); }
|
||||
vec4 shiftBy(float x, vec4 p) {
|
||||
@@ -32,11 +30,7 @@ vec4 projNear (vec4 pos)
|
||||
vec4 shiftNear(vec4 pos)
|
||||
{
|
||||
vec4 sp = shift(pos);
|
||||
if (sp.z > 100) {
|
||||
return projNear(pos);
|
||||
} else {
|
||||
return sp;
|
||||
}
|
||||
return (sp.z > 100 ? projNear(pos) : sp);
|
||||
}
|
||||
int ks[6] =
|
||||
{0,1,2 // 2--3
|
||||
@@ -59,9 +53,6 @@ void main()
|
||||
vec3 lightDir2 = p1.xyz - lightPos.xyz;
|
||||
vec4 p2 = shiftNear(p0);
|
||||
vec4 p3 = shiftNear(p1);
|
||||
vec4 ps[4] = {p0,p1,p2,p3};
|
||||
vec4 sp[4] = {p1,p0,p3,p2};
|
||||
gl_Position = vec4(0,0,0,1);
|
||||
// first test if the edge is part of the silhouette
|
||||
// that is, if the normals of the faces connected by the edge point are in
|
||||
// "different directions" wrt the light direction
|
||||
@@ -70,9 +61,13 @@ void main()
|
||||
// using <= rather than < seems to get rid of overlapping shadow
|
||||
// artefacts
|
||||
{
|
||||
if (dot(n0, lightDir) > 0) {gl_Position = theMat * sp[k];}
|
||||
else {gl_Position = theMat * ps[k]; }
|
||||
//gl_Position = vec4(1,1,1,0);
|
||||
if (dot(n0, lightDir) > 0)
|
||||
{
|
||||
vec4 sp[4] = {p1,p0,p3,p2};
|
||||
gl_Position = theMat * sp[k];}
|
||||
else {
|
||||
vec4 ps[4] = {p0,p1,p2,p3};
|
||||
gl_Position = theMat * ps[k]; }
|
||||
}
|
||||
else {gl_Position = vec4(1,1,1,0);}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user