test/snake/shader/player.glsl

changeset 242
6eeb987f1681
parent 137
f8e6e0ae61a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/snake/shader/player.glsl	Sat Aug 02 15:19:06 2025 +0200
@@ -0,0 +1,16 @@
+layout(location = 0) out vec4 diffuse;
+in vec2 uvcoord;
+
+uniform sampler2D map_albedo;
+uniform sampler2D map_color;
+uniform vec4 color;
+
+void main(void) {
+    // TODO: use greyscale texture instead
+    vec4 color_map_pixel = texture(map_color, uvcoord);
+    if (color_map_pixel.a > 0) {
+        diffuse = color * color_map_pixel * texture(map_albedo, uvcoord);
+    } else {
+        diffuse = texture(map_albedo, uvcoord);
+    }
+}

mercurial