Ticket #1770: bloom.fs

File bloom.fs, 888 bytes (added by myconid, 11 years ago)
Line 
1#version 110
2
3varying vec2 v_tex;
4uniform sampler2D renderedTex;
5uniform vec2 texSize;
6
7void main()
8{
9 #if BLOOM_NOP
10 gl_FragColor = texture2D(renderedTex, v_tex);
11 gl_FragColor.a = 1.0;
12 #endif
13
14 #if BLOOM_PASS_H
15 vec4 colour = vec4(0.0);
16 vec2 v_tex_offs = vec2(v_tex.x - 0.01, v_tex.y);
17
18 for (int i = 0; i < 6; ++i)
19 {
20 colour += texture2D(renderedTex, v_tex_offs);
21 v_tex_offs += vec2(0.004, 0.0);
22 }
23
24 gl_FragColor.rgb = colour.rgb / 6.0;
25 gl_FragColor.a = 1.0;
26 #endif
27
28 #if BLOOM_PASS_V
29 vec4 colour = vec4(0.0);
30 vec2 v_tex_offs = vec2(v_tex.x, v_tex.y - 0.01);
31
32 for (int i = 0; i < 6; ++i)
33 {
34 colour += texture2D(renderedTex, v_tex_offs);
35 v_tex_offs += vec2(0.0, 0.004);
36 }
37
38 gl_FragColor.rgb = colour.rgb / 6.0;
39 gl_FragColor.a = 1.0;
40 #endif
41}