summaryrefslogtreecommitdiff
path: root/tiled.glsl
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-07-09 22:47:25 +0100
committerdavidovski <david@davidovski.xyz>2023-07-09 22:47:25 +0100
commit80489b02d737848395506b218b27b86dc116d8b4 (patch)
treee74e9351b6fadef073b5adbda19ab94fe0df1186 /tiled.glsl
parent7b6726504eca15933f7d5d14acf98cb3386acca4 (diff)
use texture to pass tilemap
Diffstat (limited to 'tiled.glsl')
-rw-r--r--tiled.glsl5
1 files changed, 3 insertions, 2 deletions
diff --git a/tiled.glsl b/tiled.glsl
index 9d00690..3ec1c66 100644
--- a/tiled.glsl
+++ b/tiled.glsl
@@ -10,12 +10,12 @@ in vec4 fragColor;
uniform sampler2D texture0;
uniform sampler2D texture1;
+uniform sampler2D texture2;
uniform vec2 resolution;
uniform vec2 offset;
uniform float zoom;
uniform ivec2 atlasSize;
-uniform int tilemap[MAP_H][MAP_W];
out vec4 finalColor;
@@ -65,6 +65,7 @@ void main() {
finalColor = none;
} else {
vec2 position = mod(uv, 1);
- finalColor = tile(position, tilemap[tilemapPos.y][tilemapPos.x]);
+ int tileIndex = int(256*texelFetch(texture2, tilemapPos, 0).r);
+ finalColor = tile(position, tileIndex);
}
}