Cleanup
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
#version 450 core
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 4) out;
|
||||
layout(std140, binding = 0) uniform TheMat { mat4 theMat; };
|
||||
void main() {
|
||||
vec2 p1 = gl_in[0].gl_Position.xy;
|
||||
vec2 p2 = gl_in[0].gl_Position.zw;
|
||||
gl_Position = theMat * vec4(p1,100,1); EmitVertex();
|
||||
gl_Position = theMat * vec4(p1,5000,1); EmitVertex();
|
||||
gl_Position = theMat * vec4(p2,100,1); EmitVertex();
|
||||
gl_Position = theMat * vec4(p2,5000,1); EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
#version 450 core
|
||||
//layout (location = 0) in vec4 poss;
|
||||
//void main()
|
||||
//{
|
||||
// gl_Position = poss;
|
||||
//}
|
||||
struct PosTex { vec4 pospos; vec4 texang; };
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
layout (std430, binding = 2) readonly buffer Pos { PosTex data[]; };
|
||||
|
||||
@@ -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