Almost working shadows
This commit is contained in:
@@ -10,18 +10,31 @@ void main()
|
||||
vec4 p0 = gl_in[0].gl_Position;
|
||||
vec3 n0 = gl_in[2].gl_Position.xyz;
|
||||
vec3 n1 = gl_in[3].gl_Position.xyz;
|
||||
vec3 n2 = n0 + n1; // assumes the summands are normalized
|
||||
vec3 lightDir = p0.xyz - lightPos.xyz;
|
||||
if ( dot(n0 , lightDir) * dot(n1 , lightDir) < 0 );
|
||||
// first test if the edge is part of the silhouette
|
||||
// that is, if the normals of the faces connected by the edge point in
|
||||
// "different directions" wrt the light direction
|
||||
if ( dot(n0 , lightDir) * dot(n1 , lightDir) < 0 )
|
||||
{
|
||||
gl_Position = f(p0); EmitVertex();
|
||||
vec4 p1 = gl_in[1].gl_Position;
|
||||
gl_Position = f(p1); EmitVertex();
|
||||
vec4 p2 = shift(p0);
|
||||
gl_Position = f(p2); EmitVertex();
|
||||
vec4 p3 = shift(p1);
|
||||
gl_Position = f(p3); EmitVertex();
|
||||
if ( dot(n0 , lightDir) > 0)
|
||||
{
|
||||
gl_Position = f(p0); EmitVertex();
|
||||
gl_Position = f(p1); EmitVertex();
|
||||
gl_Position = f(p2); EmitVertex();
|
||||
gl_Position = f(p3); EmitVertex();
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_Position = f(p1); EmitVertex();
|
||||
gl_Position = f(p0); EmitVertex();
|
||||
gl_Position = f(p3); EmitVertex();
|
||||
gl_Position = f(p2); EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
{
|
||||
}
|
||||
else { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user