ld33_umonster
view sdr/shadow-notex.p.glsl @ 2:35349df5392d
wtf?
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 22 Aug 2015 23:55:21 +0300 |
parents | 4a6683050e29 |
children | 93ff21458a16 |
line source
1 /* vi: set ft=glsl */
2 //uniform sampler2DShadow shadowmap;
4 varying vec3 vdir, ldir, normal;
5 varying vec4 shadow_tc;
7 #define KD gl_FrontMaterial.diffuse.rgb
8 #define KS gl_FrontMaterial.specular.rgb
9 #define SPOW gl_FrontMaterial.shininess
11 void main()
12 {
13 float shadow = 1.0;//shadow2DProj(shadowmap, shadow_tc).x;
15 vec3 n = normalize(normal);
16 /*vec3 v = normalize(vdir);
17 vec3 l = normalize(ldir);
18 vec3 h = normalize(l + v);
20 float ndotl = max(dot(n, l), 0.0);
21 float ndoth = max(dot(n, h), 0.0);
23 vec3 diffuse = KD * gl_LightSource[0].diffuse.rgb * ndotl;
24 vec3 specular = vec3(0.0, 0.0, 0.0);//KS * gl_LightSource[0].specular.rgb * pow(ndoth, SPOW);
26 vec3 ambient = gl_LightModel.ambient.rgb * KD;
27 gl_FragColor.rgb = ambient + (diffuse + specular) * shadow;
28 gl_FragColor.a = gl_FrontMaterial.diffuse.a;
29 */
30 gl_FragColor.rgb = n * 0.5 + 0.5;
31 gl_FragColor.a = 1.0;
32 }