things/_templates/raylib/pixelart/upscale.frag

16 lines
456 B
GLSL

#version 330
uniform sampler2D texture0;
uniform ivec2 texture0_size;
uniform float px_per_tx;
in vec2 fragTexCoord;
in vec4 fragColor;
out vec4 finalColor;
void main() { vec2 uv = vec2(fragTexCoord.x, fragTexCoord.y);
vec2 tx = uv * vec2(texture0_size);
vec2 off = clamp(fract(tx) * px_per_tx, 0, 0.5) - clamp((1 - fract(tx)) * px_per_tx, 0, 0.5);
vec2 pos = (floor(tx) + 0.5 + off) / vec2(texture0_size);
finalColor = texture(texture0, pos);
}