2016-06-14 14:11:37 +03:00
|
|
|
vec4 scale(sampler2D image)
|
2016-04-28 23:07:05 +03:00
|
|
|
{
|
|
|
|
vec2 texCoord = vec2(gl_FragCoord.x, uResolution.y - gl_FragCoord.y) / uResolution;
|
|
|
|
|
2016-06-09 00:06:55 +03:00
|
|
|
vec2 pixel = texCoord * textureDimensions - vec2(0.5, 0.5);
|
2016-04-28 23:07:05 +03:00
|
|
|
|
2018-03-11 14:56:15 +01:00
|
|
|
vec4 q11 = texture(image, (floor(pixel) + 0.5) / textureDimensions);
|
|
|
|
vec4 q12 = texture(image, (vec2(floor(pixel.x), ceil(pixel.y)) + 0.5) / textureDimensions);
|
|
|
|
vec4 q21 = texture(image, (vec2(ceil(pixel.x), floor(pixel.y)) + 0.5) / textureDimensions);
|
|
|
|
vec4 q22 = texture(image, (ceil(pixel) + 0.5) / textureDimensions);
|
2016-04-28 23:07:05 +03:00
|
|
|
|
2016-06-18 02:05:52 +03:00
|
|
|
vec2 s = smoothstep(0., 1., fract(pixel));
|
2016-04-28 23:07:05 +03:00
|
|
|
|
2018-03-11 15:09:30 +01:00
|
|
|
vec4 r1 = mix(q11, q21, s.x);
|
|
|
|
vec4 r2 = mix(q12, q22, s.x);
|
2016-04-28 23:07:05 +03:00
|
|
|
|
2018-03-11 15:09:30 +01:00
|
|
|
return mix (r1, r2, s.y);
|
2016-04-28 23:07:05 +03:00
|
|
|
}
|