| 1 |
#version 450 |
| 2 |
|
| 3 |
layout(location = 0) out vec4 FragColor; |
| 4 |
layout(location = 0) flat in vec2 vTex; |
| 5 |
layout(location = 1) flat in int vIndex; |
| 6 |
layout(binding = 0) uniform sampler2D uSampler[4]; |
| 7 |
layout(binding = 4) uniform sampler uSamplers[4]; |
| 8 |
layout(binding = 8) uniform texture2D uTextures[4]; |
| 9 |
|
| 10 |
vec4 sample_from_argument(sampler2D samplers[4]) |
| 11 |
{ |
| 12 |
return texture(samplers[vIndex], vTex + 0.2); |
| 13 |
} |
| 14 |
|
| 15 |
vec4 sample_single_from_argument(sampler2D samp) |
| 16 |
{ |
| 17 |
return texture(samp, vTex + 0.3); |
| 18 |
} |
| 19 |
|
| 20 |
vec4 sample_from_global() |
| 21 |
{ |
| 22 |
return texture(uSampler[vIndex], vTex + 0.1); |
| 23 |
} |
| 24 |
|
| 25 |
void main() |
| 26 |
{ |
| 27 |
FragColor = vec4(0.0); |
| 28 |
FragColor += texture(sampler2D(uTextures[2], uSamplers[1]), vTex); |
| 29 |
FragColor += texture(uSampler[vIndex], vTex); |
| 30 |
FragColor += sample_from_global(); |
| 31 |
FragColor += sample_from_argument(uSampler); |
| 32 |
FragColor += sample_single_from_argument(uSampler[3]); |
| 33 |
} |