#version 130
#extension GL_EXT_gpu_shader4 : enable

uniform sampler3D tileTexture;
uniform vec3 tileMin;
uniform vec3 tileMax;
uniform float sliceCount;

in vec2 texCoord;
out vec4 fragColor;

void main()
{
  vec3 coord = vec3(texCoord.x, fract(texCoord.y), (floor(texCoord.y) + 0.5) / sliceCount);
  fragColor = texture(tileTexture, mix(tileMin, tileMax, coord));
}
