aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/assets/skyhanni/shaders/standard_chroma.fsh37
-rw-r--r--src/main/resources/assets/skyhanni/shaders/standard_chroma.vsh13
-rw-r--r--src/main/resources/assets/skyhanni/shaders/textured_chroma.fsh (renamed from src/main/resources/assets/skyhanni/shaders/chroma.fsh)8
-rw-r--r--src/main/resources/assets/skyhanni/shaders/textured_chroma.vsh (renamed from src/main/resources/assets/skyhanni/shaders/chroma.vsh)8
4 files changed, 58 insertions, 8 deletions
diff --git a/src/main/resources/assets/skyhanni/shaders/standard_chroma.fsh b/src/main/resources/assets/skyhanni/shaders/standard_chroma.fsh
new file mode 100644
index 000000000..8e10708bb
--- /dev/null
+++ b/src/main/resources/assets/skyhanni/shaders/standard_chroma.fsh
@@ -0,0 +1,37 @@
+// Chroma Fragment Shader
+// (Same as textured_chroma.fsh but isn't restricted to textured elements)
+
+#version 130
+
+uniform float chromaSize;
+uniform float timeOffset;
+uniform float saturation;
+uniform bool forwardDirection;
+
+in vec4 originalColor;
+
+float rgb2b(vec3 rgb) {
+ return max(max(rgb.r, rgb.g), rgb.b);
+}
+
+vec3 hsb2rgb_smooth(vec3 c) {
+ vec3 rgb = clamp(abs(mod(c.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
+ rgb = rgb * rgb * (3.0 - 2.0 * rgb); // Cubic smoothing
+ return c.z * mix(vec3(1.0), rgb, c.y);
+}
+
+void main() {
+ // Determine the direction chroma moves
+ float fragCoord;
+ if (forwardDirection) {
+ fragCoord = gl_FragCoord.x - gl_FragCoord.y;
+ } else {
+ fragCoord = gl_FragCoord.x + gl_FragCoord.y;
+ }
+
+ // The hue takes in account the position, chroma settings, and time
+ float hue = mod(((fragCoord) / chromaSize) - timeOffset, 1.0);
+
+ // Set the color to use the new hue & original saturation/value/alpha values
+ gl_FragColor = vec4(hsb2rgb_smooth(vec3(hue, saturation, rgb2b(originalColor.rgb))), originalColor.a);
+} \ No newline at end of file
diff --git a/src/main/resources/assets/skyhanni/shaders/standard_chroma.vsh b/src/main/resources/assets/skyhanni/shaders/standard_chroma.vsh
new file mode 100644
index 000000000..4895d119e
--- /dev/null
+++ b/src/main/resources/assets/skyhanni/shaders/standard_chroma.vsh
@@ -0,0 +1,13 @@
+// Chroma Vertex Shader
+// (Same as textured_chroma.vsh but isn't restricted to only texture elements)
+
+#version 130
+
+out vec4 originalColor;
+
+void main() {
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ // Pass original color to fragment
+ originalColor = gl_Color;
+} \ No newline at end of file
diff --git a/src/main/resources/assets/skyhanni/shaders/chroma.fsh b/src/main/resources/assets/skyhanni/shaders/textured_chroma.fsh
index 7b48a62f9..2f3d76af7 100644
--- a/src/main/resources/assets/skyhanni/shaders/chroma.fsh
+++ b/src/main/resources/assets/skyhanni/shaders/textured_chroma.fsh
@@ -1,8 +1,8 @@
-// Chroma Fragment Shader
+// Textured Chroma Fragment Shader
// Modified from SkyblockAddons
// Credit: https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/resources/assets/skyblockaddons/shaders/program/chroma_screen_textured.fsh
-#version 120
+#version 130
uniform float chromaSize;
uniform float timeOffset;
@@ -11,8 +11,8 @@ uniform bool forwardDirection;
uniform sampler2D outTexture;
-varying vec2 outTextureCoords;
-varying vec4 outColor;
+in vec2 outTextureCoords;
+in vec4 outColor;
float rgb2b(vec3 rgb) {
return max(max(rgb.r, rgb.g), rgb.b);
diff --git a/src/main/resources/assets/skyhanni/shaders/chroma.vsh b/src/main/resources/assets/skyhanni/shaders/textured_chroma.vsh
index 5f5030d07..87ca9fece 100644
--- a/src/main/resources/assets/skyhanni/shaders/chroma.vsh
+++ b/src/main/resources/assets/skyhanni/shaders/textured_chroma.vsh
@@ -1,10 +1,10 @@
-// Chroma Vertex Shader
+// Textured Chroma Vertex Shader
// Credit: https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/resources/assets/skyblockaddons/shaders/program/chroma_screen_textured.vsh
-#version 120
+#version 130
-varying vec2 outTextureCoords;
-varying vec4 outColor;
+out vec2 outTextureCoords;
+out vec4 outColor;
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;