diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-02 00:36:34 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-02 00:36:34 +0200 |
commit | 742579ca2fce1effe942928f5b94401e1e723f34 (patch) | |
tree | ba11651aecd68edc12d3f5c69c04b6c2f6c2ee79 /shaders | |
parent | 3dc6362599e85c9978ec4e9676ebcda3ab52beaf (diff) |
foo
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/tile-shader.frag | 10 | ||||
-rw-r--r-- | shaders/tile-shader.vert | 17 |
2 files changed, 12 insertions, 15 deletions
diff --git a/shaders/tile-shader.frag b/shaders/tile-shader.frag index 8a31a1e1..0f487386 100644 --- a/shaders/tile-shader.frag +++ b/shaders/tile-shader.frag @@ -1,14 +1,12 @@ -#version 450 precision highp float; -const int MAX_SAMPLERS = 16; -layout (location = 0) uniform sampler2D samplers[MAX_SAMPLERS]; +uniform sampler2D samplers[32]; -layout (location = 0) in vec2 texcoord; -layout (location = 1) flat in uint sampler_id; +in vec2 out_texcoords; +flat in uint frag_sampler_id; out vec4 fragmentColor; void main() { - fragmentColor.rgb = texture(samplers[sampler_id], texcoord).rgb; + fragmentColor.rgb = texture(samplers[frag_sampler_id], out_texcoords).rgb; fragmentColor.a = 1; } diff --git a/shaders/tile-shader.vert b/shaders/tile-shader.vert index 6c12f1e2..17ead0d9 100644 --- a/shaders/tile-shader.vert +++ b/shaders/tile-shader.vert @@ -1,19 +1,18 @@ -#version 450 precision highp float; layout (location = 0) uniform vec2 scale; layout (location = 1) uniform vec2 offset; +uniform sampler2D samplers[32]; -layout(location = 0) in vec4 position; -layout(location = 1) in vec2 texcoord; -layout(location = 2) flat in uint sampler_id; - -layout (location = 0) out vec2 out_texcoord; -layout (location = 1) flat out uint out_sampler_id; +in vec4 position; +in vec2 texcoords; +in uint sampler_id; +out vec2 out_texcoords; +flat out uint frag_sampler_id; void main() { - interpolatedTextureCoordinates = texcoord; - out_sampler_id = sampler_id; + out_texcoords = texcoords; + frag_sampler_id = sampler_id; float cx = 2/scale.x, cy = 2/scale.y; float x = position.y, y = position.x, z = position.z; |