SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
Shaders/SmoothBilinear.fsh
1 STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 output_resolution)
2 {
3 vec2 pixel = position * input_resolution - vec2(0.5, 0.5);
4
5 vec4 q11 = texture(image, (floor(pixel) + 0.5) / input_resolution);
6 vec4 q12 = texture(image, (vec2(floor(pixel.x), ceil(pixel.y)) + 0.5) / input_resolution);
7 vec4 q21 = texture(image, (vec2(ceil(pixel.x), floor(pixel.y)) + 0.5) / input_resolution);
8 vec4 q22 = texture(image, (ceil(pixel) + 0.5) / input_resolution);
9
10 vec2 s = smoothstep(0., 1., fract(pixel));
11
12 vec4 r1 = mix(q11, q21, s.x);
13 vec4 r2 = mix(q12, q22, s.x);
14
15 return mix (r1, r2, s.y);
16 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.