dungeon_crawler

view prototype/sdr/deferred_omni.p.glsl @ 30:938a6a155c94

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 27 Aug 2012 04:03:22 +0300
parents 2fc004802739
children 0357994effe2
line source
1 uniform sampler2D mrt0, mrt1, mrt2, mrt3;
2 uniform vec2 tex_scale, fb_size;
4 varying vec3 ltpos;
6 void main()
7 {
8 vec2 tc = gl_FragCoord.xy * tex_scale / fb_size;
10 vec3 pos = texture2D(mrt0, tc).xyz;
11 vec3 norm = texture2D(mrt1, tc).xyz;
13 vec4 texel3 = texture2D(mrt2, tc);
14 vec3 dcol = texel3.xyz;
15 float shin = texel3.w;
17 vec3 ldir = ltpos - pos;
18 float dist = length(ldir);
19 ldir = normalize(ldir);
21 float ndotl = dot(norm, ldir);
22 vec3 color = dcol * ndotl;
24 float atten = 1.0;
25 if(dist > 0.2) {
26 atten = 0.0;
27 }
29 gl_FragColor = vec4(color, 1.0);
30 }