aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDickby <[email protected]>2023-11-12 17:20:23 +0100
committerGitHub <[email protected]>2023-11-12 16:20:23 +0000
commite974d1fe98087c7eff333345f58155437ca529cd (patch)
tree4107e91f2663cd3e048f75c81fdb2dc155da0648
parent47d46aa56cc9c0c853401275bbe920e902f7d5e6 (diff)
downloadHyprland-e974d1fe98087c7eff333345f58155437ca529cd.tar.gz
Hyprland-e974d1fe98087c7eff333345f58155437ca529cd.zip
shaders: Some more changes in rgb2hsl. (#3834)
-rw-r--r--src/render/shaders/Textures.hpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp
index e32712fa..e78f39fc 100644
--- a/src/render/shaders/Textures.hpp
+++ b/src/render/shaders/Textures.hpp
@@ -234,11 +234,11 @@ vec3 rgb2hsl(vec3 col) {
sat = delta / (mul * 2.0);
}
- vec3 masks = vec3((maxc == red && maxc != green) ? 1.0 : 0.0, (maxc == green && maxc != blue) ? 1.0 : 0.0, (maxc == blue && maxc != red) ? 1.0 : 0.0);
-
- vec3 adds = vec3(((green - blue) / delta), 2.0 + ((blue - red) / delta), 4.0 + ((red - green) / delta));
-
if (delta > 0.0) {
+ vec3 maxcVec = vec3(maxc);
+ vec3 masks = vec3(equal(maxcVec, col)) * vec3(notEqual(maxcVec, vec3(green, blue, red)));
+ vec3 adds = vec3(0.0, 2.0, 4.0) + vec3(green - blue, blue - red, red - green) / delta;
+
hue += dot(adds, masks);
hue /= 6.0;
@@ -248,6 +248,7 @@ vec3 rgb2hsl(vec3 col) {
return vec3(hue, sat, lum);
}
+
vec3 hsl2rgb(vec3 col) {
const float onethird = 1.0 / 3.0;
const float twothird = 2.0 / 3.0;