mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-12 06:41:51 +09:00
moved essential resources out of the assets directory and into the jar
This commit is contained in:
37
src/shaders/blur2.frag
Normal file
37
src/shaders/blur2.frag
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
|
||||
uniform vec2 iResolution;
|
||||
uniform float flip;
|
||||
uniform vec2 direction;
|
||||
|
||||
vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
|
||||
vec4 color = vec4(0.0);
|
||||
vec2 off1 = vec2(1.411764705882353) * direction;
|
||||
vec2 off2 = vec2(3.2941176470588234) * direction;
|
||||
vec2 off3 = vec2(5.176470588235294) * direction;
|
||||
color += texture2D(image, uv) * 0.1964825501511404;
|
||||
color += texture2D(image, uv + (off1 / resolution)) * 0.2969069646728344;
|
||||
color += texture2D(image, uv - (off1 / resolution)) * 0.2969069646728344;
|
||||
color += texture2D(image, uv + (off2 / resolution)) * 0.09447039785044732;
|
||||
color += texture2D(image, uv - (off2 / resolution)) * 0.09447039785044732;
|
||||
color += texture2D(image, uv + (off3 / resolution)) * 0.010381362401148057;
|
||||
color += texture2D(image, uv - (off3 / resolution)) * 0.010381362401148057;
|
||||
return color;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = vec2(gl_FragCoord.xy / iResolution.xy);
|
||||
if (flip == 1.0) {
|
||||
uv.y = 1.0 - uv.y;
|
||||
}
|
||||
|
||||
gl_FragColor = blur(u_texture, uv, iResolution.xy, direction);
|
||||
}
|
||||
Reference in New Issue
Block a user