aboutsummaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-10-18 23:09:54 +0000
committernathan <nathansmith@disroot.org>2025-10-18 23:09:54 +0000
commite3f220ee2003e93b2a1ebc335630fac8444a412e (patch)
tree748a84ea22be2a39f104b18940b9f77b80556b6b /assets
parentadf84529a0f59bccea0e111b0f76d2eef3968971 (diff)
downloadFindThings-e3f220ee2003e93b2a1ebc335630fac8444a412e.tar.gz
FindThings-e3f220ee2003e93b2a1ebc335630fac8444a412e.tar.bz2
FindThings-e3f220ee2003e93b2a1ebc335630fac8444a412e.zip
Color thingy
Diffstat (limited to 'assets')
-rw-r--r--assets/shaders/glsl330/color-depth.fs24
1 files changed, 24 insertions, 0 deletions
diff --git a/assets/shaders/glsl330/color-depth.fs b/assets/shaders/glsl330/color-depth.fs
new file mode 100644
index 0000000..c011df5
--- /dev/null
+++ b/assets/shaders/glsl330/color-depth.fs
@@ -0,0 +1,24 @@
+#version 330
+
+in vec2 fragTexCoord;
+in vec4 fragColor;
+
+uniform sampler2D texture0;
+uniform vec4 colDiffuse;
+
+out vec4 finalColor;
+
+const int factor = 30; // x/255
+
+void main()
+{
+ // Texel color fetching from texture sampler
+ vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor;
+
+ ivec4 color = ivec4(texelColor / factor * 255);
+ color *= factor;
+
+ // Calculate final fragment color
+ finalColor = vec4(float(color.r) / 255, float(color.g) / 255,
+ float(color.b) / 255, texelColor.a);
+} \ No newline at end of file