dungeon_crawler

view prototype/sdr/mrt.p.glsl @ 33:0357994effe2

ha! fixed deferred
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 28 Aug 2012 03:18:47 +0300
parents 48cfd351a9be
children 85734f319626
line source
1 /* MRT assignments
2 * 0 - RGB: position
3 * 1 - RGB: normal
4 * 3 - RGB: diffuse color, A: shininess str.
5 * 4 - unused
6 */
8 uniform sampler2D tex_dif, tex_norm;
10 varying vec3 pos, norm;
12 void main()
13 {
14 vec3 n = normalize(norm);
16 vec4 texel = texture2D(tex_dif, gl_TexCoord[0].st);
17 vec3 diffuse = (gl_FrontMaterial.diffuse * texel).xyz;
18 vec3 spec = gl_FrontMaterial.specular.xyz;
19 float sstr = (spec.x + spec.y + spec.z) / 3.0;
21 gl_FragData[0] = vec4(pos, 0.0);
22 gl_FragData[1] = vec4(norm, 0.0);
23 gl_FragData[2] = vec4(diffuse, sstr);
24 //gl_FragData[3] = vec4(0.0, 0.0, 0.0, 0.0);
25 }