2023-09-05 15:47:55 +00:00
|
|
|
|
|
|
|
layout(set = 0, binding = 0) uniform sampler2D tex;
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 worldpos;
|
|
|
|
layout(location = 0) out vec4 fragcolor;
|
|
|
|
|
2023-09-06 17:44:53 +00:00
|
|
|
vec4 centerFragColor;
|
|
|
|
|
|
|
|
vec4 clampedSample(vec4 f)
|
|
|
|
{
|
|
|
|
return f != vec4(0, 0, 0, 0) ? f : centerFragColor;
|
|
|
|
}
|
|
|
|
|
2023-09-05 15:47:55 +00:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
ivec2 size = textureSize(tex, 0);
|
|
|
|
vec2 texCoord = gl_FragCoord.xy / vec2(size);
|
|
|
|
|
2023-09-06 17:44:53 +00:00
|
|
|
centerFragColor = textureOffset(tex, texCoord, ivec2(0, 0));
|
|
|
|
|
2023-09-05 15:47:55 +00:00
|
|
|
#if defined(BLUR_HORIZONTAL)
|
|
|
|
fragcolor =
|
2023-09-06 17:44:53 +00:00
|
|
|
centerFragColor * 0.5 +
|
|
|
|
clampedSample(textureOffset(tex, texCoord, ivec2( 1, 0))) * 0.25 +
|
|
|
|
clampedSample(textureOffset(tex, texCoord, ivec2(-1, 0))) * 0.25;
|
2023-09-05 15:47:55 +00:00
|
|
|
#else
|
|
|
|
fragcolor =
|
2023-09-06 17:44:53 +00:00
|
|
|
centerFragColor * 0.5 +
|
|
|
|
clampedSample(textureOffset(tex, texCoord, ivec2(0, 1))) * 0.25 +
|
|
|
|
clampedSample(textureOffset(tex, texCoord, ivec2(0,-1))) * 0.25;
|
2023-09-05 15:47:55 +00:00
|
|
|
#endif
|
|
|
|
}
|