mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
28 lines
584 B
GLSL
28 lines
584 B
GLSL
//
|
|
// Simple passthrough fragment shader
|
|
//
|
|
varying vec2 v_vTexcoord;
|
|
varying vec4 v_vColour;
|
|
|
|
uniform float strength;
|
|
uniform float direction;
|
|
|
|
vec4 dirBlur(vec2 angle) {
|
|
vec4 acc = vec4(0.);
|
|
|
|
const float delta = 2.0 / 32.;
|
|
|
|
for(float i = -1.0; i <= 1.0; i += delta) {
|
|
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord - vec2(angle.x * i, angle.y * i));
|
|
acc += col;
|
|
}
|
|
acc.rgb *= 0.5;
|
|
return acc * delta;
|
|
}
|
|
|
|
void main() {
|
|
float r = radians(direction);
|
|
vec2 dirr = vec2(sin(r), cos(r));
|
|
|
|
gl_FragColor = dirBlur(strength * dirr);
|
|
} |