Files
loop/shader/bezierQuad.frag
T

33 lines
788 B
GLSL

#version 430 core
in vec4 gColor;
in vec3 gBoundingBox;
in vec2 box2;
in float wStart;
in float wEnd;
// the width is calculated along the line a-c
// this should instead be along the lines a-b (for start width)
// and b-c (for end width)
out vec4 fColor;
float x = gBoundingBox.x;
float y = gBoundingBox.y;
float z = gBoundingBox.z;
float f (float a, float b)
{
float c = 1 / (1 - 2*b) ;
return c * (a - 0.5) + 0.5 ;
}
void main()
{
//float d = x - y - 1 + 2* sqrt(y);
float d = sqrt(x) + sqrt(y) - 1;
// float e = sqrt(f(x,wStart)) + sqrt(f(y,wEnd)) - 1.0;
float e = sqrt(box2.x) + sqrt(box2.y) - 1.0;
// if ( d < 0 || e > 0) { discard; }
fColor = gColor;
// if ( d < 0 || e > 0) { fColor = vec4(0,0,1,1); }
if ( d < 0 || e > 0) { fColor = vec4(0,0,1,1); }
}