Reorganise shaders

This commit is contained in:
2021-03-21 12:50:27 +01:00
parent a8ebf2f7f1
commit cf5a8b3e1b
32 changed files with 22 additions and 60 deletions
+34
View File
@@ -0,0 +1,34 @@
#version 430 core
in vec4 gColor;
in vec2 cenPosT;
in float gRadIn;
in float gRadOut;
in vec2 angles;
out vec4 fColor;
out float gl_FragDepth;
uniform float rotation;
void main()
{
vec2 pos = gl_FragCoord.xy;
float d = distance(pos,cenPosT);
float dTest = max ( step(gRadOut/2,d)
, 1 - step(gRadIn/2,d)
);
vec2 posDiff = pos - cenPosT;
float sa = angles.x - rotation;
vec2 sv = vec2 (-sin(sa), cos(sa));
float saTest = dot(sv,posDiff) >= 0 ? 0 : 1;
float ea = angles.y - rotation;
vec2 ev = vec2 (-sin(ea), cos(ea));
float eaTest = dot(ev,posDiff) <= 0 ? 0 : 1;
float aTest = ea - sa < radians(180) ? max (saTest,eaTest)
: min (saTest,eaTest);
float onArcTest = max(dTest,aTest);
gl_FragDepth = max(gl_FragCoord.z , onArcTest);
fColor = gColor;
}