dungeon_crawler

annotate prototype/sdr/mrt.p.glsl @ 29:2fc004802739

lalala
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 26 Aug 2012 03:39:32 +0300
parents 8a0ae6b4aa9b
children 0357994effe2
rev   line source
nuclear@20 1 /* MRT assignments
nuclear@20 2 * 0 - RGB: position
nuclear@20 3 * 1 - RGB: normal
nuclear@20 4 * 3 - RGB: diffuse color, A: shininess str.
nuclear@20 5 * 4 - unused
nuclear@20 6 */
nuclear@20 7
nuclear@20 8 uniform sampler2D tex_dif, tex_norm;
nuclear@20 9
nuclear@20 10 varying vec3 pos, norm;
nuclear@16 11
nuclear@16 12 void main()
nuclear@16 13 {
nuclear@20 14 vec3 n = normalize(norm);
nuclear@20 15
nuclear@16 16 vec4 texel = texture2D(tex_dif, gl_TexCoord[0].st);
nuclear@20 17 vec3 diffuse = (gl_FrontMaterial.diffuse * texel).xyz;
nuclear@20 18 vec3 spec = gl_FrontMaterial.specular.xyz;
nuclear@20 19 float sstr = (spec.x + spec.y + spec.z) / 3.0;
nuclear@20 20
nuclear@20 21 gl_FragData[0] = vec4(pos, 0.0);
nuclear@20 22 gl_FragData[1] = vec4(norm, 0.0);
nuclear@20 23 gl_FragData[2] = vec4(diffuse, sstr);
nuclear@20 24 gl_FragData[3] = vec4(0.0, 0.0, 0.0, 0.0);
nuclear@16 25 }