dungeon_crawler
view prototype/sdr/mrt.p.glsl @ 34:85734f319626
passing shininess and specular in mrt
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 28 Aug 2012 03:34:56 +0300 |
parents | 0357994effe2 |
children | d0e93b4d9ec9 |
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, gl_FrontMaterial.shininess);
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 }