diff options
author | davidovski <david@davidovski.xyz> | 2023-07-09 22:47:25 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-07-09 22:47:25 +0100 |
commit | 80489b02d737848395506b218b27b86dc116d8b4 (patch) | |
tree | e74e9351b6fadef073b5adbda19ab94fe0df1186 /tiled.glsl | |
parent | 7b6726504eca15933f7d5d14acf98cb3386acca4 (diff) |
use texture to pass tilemap
Diffstat (limited to 'tiled.glsl')
-rw-r--r-- | tiled.glsl | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); } } |