aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickshapes/shaders/conicalgradient_core.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickshapes/shaders/conicalgradient_core.frag')
-rw-r--r--src/quickshapes/shaders/conicalgradient_core.frag22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/quickshapes/shaders/conicalgradient_core.frag b/src/quickshapes/shaders/conicalgradient_core.frag
new file mode 100644
index 0000000000..e18b80159a
--- /dev/null
+++ b/src/quickshapes/shaders/conicalgradient_core.frag
@@ -0,0 +1,22 @@
+#version 150 core
+
+#define INVERSE_2PI 0.1591549430918953358
+
+uniform sampler2D gradTabTexture;
+uniform float opacity;
+
+uniform float angle;
+
+in vec2 coord;
+
+out vec4 fragColor;
+
+void main()
+{
+ 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;
+ fragColor = texture(gradTabTexture, vec2(t - floor(t), 0.5)) * opacity;
+}