diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-03 14:10:10 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-03 14:10:10 +0200 |
commit | a21d15b01588c0cab6d27b4216a64ababc2eef09 (patch) | |
tree | 2bbb337e410a39548cbd5383e0768803b2b0825c | |
parent | a16deb8ee39dd56f4b68a2808e4f619fd8d58ce7 (diff) |
a
-rw-r--r-- | main.cpp | 2 | ||||
-rw-r--r-- | shaders/tile-shader.frag | 10 | ||||
-rw-r--r-- | shaders/tile-shader.vert | 8 |
3 files changed, 8 insertions, 12 deletions
@@ -155,6 +155,7 @@ void app::drawEvent() { update(dt); } +#if 0 { //auto ratio = projection_size_ratio(); auto sz = windowSize(); @@ -165,6 +166,7 @@ void app::drawEvent() { Debug{} << _shader.project({16*50, 0, 0}); } } +#endif //auto floor1_sampler = _shader.bind_sampler(floor1); //auto wall_sampler = _shader.bind_sampler(wall1); diff --git a/shaders/tile-shader.frag b/shaders/tile-shader.frag index 0f487386..2204c991 100644 --- a/shaders/tile-shader.frag +++ b/shaders/tile-shader.frag @@ -1,12 +1,10 @@ precision highp float; -uniform sampler2D samplers[32]; +uniform sampler2D sampler; -in vec2 out_texcoords; -flat in uint frag_sampler_id; -out vec4 fragmentColor; +in vec2 frag_texcoords; +out vec4 color; void main() { - fragmentColor.rgb = texture(samplers[frag_sampler_id], out_texcoords).rgb; - fragmentColor.a = 1; + color = vec4(texture(sampler, frag_texcoords).rgb, 1); } diff --git a/shaders/tile-shader.vert b/shaders/tile-shader.vert index 17ead0d9..681a62a9 100644 --- a/shaders/tile-shader.vert +++ b/shaders/tile-shader.vert @@ -2,17 +2,13 @@ precision highp float; layout (location = 0) uniform vec2 scale; layout (location = 1) uniform vec2 offset; -uniform sampler2D samplers[32]; in vec4 position; in vec2 texcoords; -in uint sampler_id; -out vec2 out_texcoords; -flat out uint frag_sampler_id; +out vec2 frag_texcoords; void main() { - out_texcoords = texcoords; - frag_sampler_id = sampler_id; + frag_texcoords = texcoords; float cx = 2/scale.x, cy = 2/scale.y; float x = position.y, y = position.x, z = position.z; |