Allow to change menu options with rclick, move towards shader experiment

This commit is contained in:
2023-02-24 15:03:06 +00:00
parent 774316372f
commit ed9a46a18d
9 changed files with 71 additions and 42 deletions
+7 -3
View File
@@ -3,8 +3,10 @@ layout (lines_adjacency) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
//vec4 shift (vec4 p) { return (vec4 (p.xyz + (100000*(p.xyz-lightPos)), 1));}
vec4 shift (vec4 p) { return (vec4 (p.xyz + (1000*(p.xyz-lightPos)), 1));}
uniform vec4 lumRad;
//vec4 shift (vec4 p) { return (vec4 (p.xyz + (lumRad.a*normalize(p.xyz-lightPos)), 1));}
vec4 shift (vec4 p) { return (vec4 (p.xyz + (100000*(p.xyz-lightPos)), 1));}
//vec4 shift (vec4 p) { return (vec4 (lightPos + (lumRad.a*normalize(p.xyz-lightPos)), 1));}
// copied from lighting/cap.geom, should not be changed on its own
vec4 projNear (vec4 pos)
{
@@ -27,6 +29,7 @@ void main()
{
vec4 p0 = gl_in[0].gl_Position;
vec4 p1 = gl_in[1].gl_Position;
vec4 mid = 0.5*(p0 + p1);
vec3 n0a = gl_in[2].gl_Position.xyz;
vec3 n1a = gl_in[3].gl_Position.xyz;
vec3 n0 = cross(p1.xyz - p0.xyz, n0a - p0.xyz) ;
@@ -34,10 +37,11 @@ void main()
//vec3 n2 = n0 + n1; // assumes the summands are normalized
vec3 lightDir = p0.xyz - lightPos.xyz;
vec3 lightDir2 = p1.xyz - lightPos.xyz;
// 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
if ( dot(n0 , lightDir) * dot(n1 , lightDir) <= 0 )
if ( dot(n0 , lightDir) * dot(n1 , lightDir) <= 0 )
// using <= rather than < seems to get rid of overlapping shadow
// artefacts
{