aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main/resources/assets/dungeonsguide/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'mod/src/main/resources/assets/dungeonsguide/shaders')
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/shaders/chromacircle.frag27
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.frag23
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.vert19
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/shaders/donut.frag17
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag6
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.vert8
6 files changed, 98 insertions, 2 deletions
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/chromacircle.frag b/mod/src/main/resources/assets/dungeonsguide/shaders/chromacircle.frag
new file mode 100644
index 00000000..25354550
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/shaders/chromacircle.frag
@@ -0,0 +1,27 @@
+#version 120
+
+#define TWO_PI 6.28318530718
+
+uniform float radius;
+uniform vec2 centerPos;
+uniform float smoothness;
+uniform float value;
+
+
+vec3 hsv2rgb(vec3 c) {
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+void main() {
+ vec2 stuff = gl_FragCoord.xy - centerPos;
+ float sdf = length(stuff)-radius;
+ float saturation = 1.0+(sdf / radius);
+ float clampd = 1.0 - smoothstep(-smoothness, smoothness, sdf);
+ float angle = atan(-stuff.x, -stuff.y) / TWO_PI + 0.5;
+
+ vec3 col = hsv2rgb(vec3(angle, saturation, value));
+
+ gl_FragColor = vec4(col,clampd);
+} \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.frag b/mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.frag
new file mode 100644
index 00000000..7ddf2db8
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.frag
@@ -0,0 +1,23 @@
+#version 120
+uniform float radius;
+uniform vec2 halfSize;
+uniform vec2 centerPos;
+uniform float smoothness;
+varying vec4 color;
+
+vec3 hsv2rgb(vec3 c)
+{
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
+float roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {
+ return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;
+}
+
+void main() {
+ float distance = roundedBoxSDF(gl_FragCoord.xy - centerPos, halfSize, radius);
+ float smoothedAlpha = smoothstep(-smoothness,0.0, -distance);
+ gl_FragColor = vec4(hsv2rgb(color.rgb), color.a) * vec4(1.0, 1.0, 1.0, smoothedAlpha);
+} \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.vert b/mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.vert
new file mode 100644
index 00000000..377182c5
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/shaders/chromaroundrect.vert
@@ -0,0 +1,19 @@
+#version 120
+
+varying vec4 color;
+
+vec3 rgb2hsv(vec3 c)
+{
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
+
+ float d = q.x - min(q.w, q.y);
+ float e = 1.0e-10;
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
+}
+
+void main() {
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ color = vec4(rgb2hsv(gl_Color.rgb), gl_Color.a);
+} \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/donut.frag b/mod/src/main/resources/assets/dungeonsguide/shaders/donut.frag
new file mode 100644
index 00000000..cca6bc39
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/shaders/donut.frag
@@ -0,0 +1,17 @@
+#version 120
+
+
+uniform float radius;
+uniform float thickness;
+uniform vec2 centerPos;
+uniform float smoothness;
+
+
+
+void main() {
+ vec2 stuff = gl_FragCoord.xy - centerPos;
+ float sdf = abs(length(stuff)-radius);
+ float clampd = 1.0 - smoothstep(thickness, thickness+smoothness, sdf);
+
+ gl_FragColor = gl_Color * vec4(1.0, 1.0, 1.0, clampd);
+} \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag b/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag
index 93a6c7c0..95649cf4 100644
--- a/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag
+++ b/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.frag
@@ -1,8 +1,10 @@
-#version 110
+#version 120
uniform float radius;
uniform vec2 halfSize;
uniform vec2 centerPos;
uniform float smoothness;
+varying vec4 color;
+
float roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {
return length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;
@@ -11,5 +13,5 @@ float roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {
void main() {
float distance = roundedBoxSDF(gl_FragCoord.xy - centerPos, halfSize, radius);
float smoothedAlpha = smoothstep(-smoothness,0.0, -distance);
- gl_FragColor = gl_Color * vec4(1.0, 1.0, 1.0, smoothedAlpha);
+ gl_FragColor = color * vec4(1.0, 1.0, 1.0, smoothedAlpha);
} \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.vert b/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.vert
new file mode 100644
index 00000000..7a2ec153
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/shaders/roundrect.vert
@@ -0,0 +1,8 @@
+#version 120
+
+varying vec4 color;
+
+void main() {
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ color = gl_Color;
+} \ No newline at end of file