aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/shapes/shaders/conicalgradient.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/shapes/shaders/conicalgradient.frag')
-rw-r--r--src/imports/shapes/shaders/conicalgradient.frag19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/imports/shapes/shaders/conicalgradient.frag b/src/imports/shapes/shaders/conicalgradient.frag
new file mode 100644
index 0000000000..af5fdd5ee0
--- /dev/null
+++ b/src/imports/shapes/shaders/conicalgradient.frag
@@ -0,0 +1,19 @@
+#define INVERSE_2PI 0.1591549430918953358
+
+uniform sampler2D gradTabTexture;
+uniform lowp float opacity;
+
+uniform highp float angle;
+
+varying highp vec2 coord;
+
+void main()
+{
+ highp float t;
+ if (abs(coord.y) == abs(coord.x))
+ t = (atan(-coord.y + 0.002, coord.x) + angle) * INVERSE_2PI;
+ else
+ t = (atan(-coord.y, coord.x) + angle) * INVERSE_2PI;
+ gl_FragColor = texture2D(gradTabTexture, vec2(t - floor(t), 0.5)) * opacity;
+
+}