Pixel-Composer/shaders/sh_content_sampler/sh_content_sampler.fsh

25 lines
491 B
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
uniform vec2 sampler;
void main() {
2023-05-22 20:31:55 +02:00
vec2 pos = floor((v_vTexcoord * dimension) / sampler) * sampler;
pos /= dimension;
gl_FragColor = vec4(0.);
2022-01-13 05:24:03 +01:00
for(float i = 0.; i <= sampler.x; i++)
for(float j = 0.; j <= sampler.y; j++) {
vec4 col = texture2D( gm_BaseTexture, pos + vec2(i, j) / dimension);
if(col.a > 0.) {
2023-05-22 20:31:55 +02:00
gl_FragColor = vec4(1.);
return;
2022-01-13 05:24:03 +01:00
}
}
}