Broken implementation of window colours, move towards stencil ceilings
This commit is contained in:
@@ -11,5 +11,5 @@ void main()
|
||||
if (d > 1) {discard;}
|
||||
fCol = vec4(vCol.xyz,vCol.w*(1-d));
|
||||
fPos = vec4(vPosID.xyz, vCol.w*(1-d));
|
||||
fNorm = vec4(vControls.xy, 0.1 ,fPos.w); // note arbirary 0.1, might want to point downwards at the edges?
|
||||
fNorm = vec4(vControls.xy, 0.1 ,fPos.w); // note arbitrary 0.1, might want to point downwards at the edges?
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ layout(triangle_strip, max_vertices = 18) out;
|
||||
layout(std140, binding = 0) uniform TheMat { mat4 theMat; };
|
||||
layout(location=0) uniform vec3 lightPos;
|
||||
layout(location=1) uniform float rad;
|
||||
float rad2 = rad;
|
||||
//float rad = rad;
|
||||
// Preprocessed to include ../functions.glsl
|
||||
float closestPointOnLineParam (vec2 a, vec2 b, vec2 p) {
|
||||
return dot(p - a,b-a) / dot(b-a,b-a);
|
||||
@@ -19,7 +19,7 @@ vec2 closestPointOnSeg (vec2 a,vec2 b, vec2 p) {
|
||||
}
|
||||
// End include 2023-03-13 15:33:44.438312149 UTC
|
||||
vec2 shift(vec2 p) {
|
||||
return vec2(lightPos.xy + (rad2 * normalize(p - lightPos.xy)));
|
||||
return vec2(lightPos.xy + (rad * normalize(p - lightPos.xy)));
|
||||
}
|
||||
float isLHS(vec2 startV, vec2 testV) {
|
||||
return sign(-startV.x * testV.y + startV.y * testV.x);
|
||||
@@ -29,12 +29,12 @@ void main() {
|
||||
vec2 p1 = gl_in[0].gl_Position.xy;
|
||||
vec2 p2 = gl_in[0].gl_Position.zw;
|
||||
vec2 closepoint = closestPointOnSeg(p1,p2,lightPos.xy);
|
||||
if (isLHS(p1 - lightPos.xy, p2 - lightPos.xy) < 0 && distance(closepoint,lightPos.xy) < rad2) {
|
||||
vec2 closeshift = (rad2 * normalize(closepoint - lightPos.xy)) + lightPos.xy - closepoint;
|
||||
if (isLHS(p1 - lightPos.xy, p2 - lightPos.xy) < 0 && distance(closepoint,lightPos.xy) < rad) {
|
||||
vec2 closeshift = (rad * normalize(closepoint - lightPos.xy)) + lightPos.xy - closepoint;
|
||||
vec2 p1cs = p1 + closeshift;
|
||||
vec2 p1o = vec2( distance(p1,lightPos.xy) > rad2 ? p1cs : shift(p1) );
|
||||
vec2 p1o = vec2( distance(p1,lightPos.xy) > rad ? p1cs : shift(p1) );
|
||||
vec2 p2cs = p2 + closeshift;
|
||||
vec2 p2o = vec2( distance(p2,lightPos.xy) > rad2 ? p2cs : shift(p2) );
|
||||
vec2 p2o = vec2( distance(p2,lightPos.xy) > rad ? p2cs : shift(p2) );
|
||||
|
||||
gl_Position = theMat * vec4(p1o,-500,1); EmitVertex();
|
||||
gl_Position = theMat * vec4(p1,-500,1); EmitVertex();
|
||||
|
||||
Reference in New Issue
Block a user