Files
loop/shader/texture/barrel.frag
T

21 lines
514 B
GLSL

#version 450 core
in vec2 texPos;
in vec2 texDist;
in float gfactor;
in vec2 vcpos;
out vec4 fColor;
layout (binding = 1) uniform sampler2D screenTexture;
float f ( float x) {
if (x>1) {return 1;} else {return (1-gfactor)*x + gfactor;}
}
void main()
{
float t = f(length(texDist));
float r = texture(screenTexture , (t*texPos - vcpos)).r ;
vec2 gb = texture(screenTexture
, 0.5+0.5 *( vcpos + t * (texPos - vcpos))
).gb
;
fColor = vec4(r,gb,1);
}