From 592603fdeedfd4e6784606b9e7c9c8fdb306af42 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 2 Oct 2026 19:38:12 +0530 Subject: More eye stuff --- src/main/resources/shaders/modules/utils.glsl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/main/resources/shaders/modules') diff --git a/src/main/resources/shaders/modules/utils.glsl b/src/main/resources/shaders/modules/utils.glsl index 3520df1..10e3a48 100644 --- a/src/main/resources/shaders/modules/utils.glsl +++ b/src/main/resources/shaders/modules/utils.glsl @@ -7,9 +7,30 @@ float ssubtract(float a, float b, float k) { return -smin(-a, b, k); } +// Easing +float ease_in_out_quart(in float x) { + return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2; +} +vec2 ease_in_out_quart(in vec2 v) { + return vec2(ease_in_out_quart(v.x), ease_in_out_quart(v.y)); +} + +// Color utils vec3 srgb(float r, float g, float b) { return vec3(pow(r, 2.2), pow(g, 2.2), pow(b, 2.2)); } vec3 srgb(vec3 c) { return srgb(c.r, c.g, c.b); } +vec3 srgb(float c) { + return srgb(c, c, c); +} + +vec3 saturation(vec3 color, float s) { + float y = 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b; + return vec3( + y + s * (color.r - y), + y + s * (color.g - y), + y + s * (color.b - y) + ); +} -- cgit v1.3.1