annotate 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 |
rev |
line source |
nuclear@0
|
1 /* vi: set ft=glsl */
|
nuclear@2
|
2 //uniform sampler2DShadow shadowmap;
|
nuclear@0
|
3
|
nuclear@0
|
4 varying vec3 vdir, ldir, normal;
|
nuclear@0
|
5 varying vec4 shadow_tc;
|
nuclear@0
|
6
|
nuclear@0
|
7 #define KD gl_FrontMaterial.diffuse.rgb
|
nuclear@0
|
8 #define KS gl_FrontMaterial.specular.rgb
|
nuclear@0
|
9 #define SPOW gl_FrontMaterial.shininess
|
nuclear@0
|
10
|
nuclear@0
|
11 void main()
|
nuclear@0
|
12 {
|
nuclear@2
|
13 float shadow = 1.0;//shadow2DProj(shadowmap, shadow_tc).x;
|
nuclear@0
|
14
|
nuclear@0
|
15 vec3 n = normalize(normal);
|
nuclear@2
|
16 /*vec3 v = normalize(vdir);
|
nuclear@0
|
17 vec3 l = normalize(ldir);
|
nuclear@0
|
18 vec3 h = normalize(l + v);
|
nuclear@0
|
19
|
nuclear@0
|
20 float ndotl = max(dot(n, l), 0.0);
|
nuclear@0
|
21 float ndoth = max(dot(n, h), 0.0);
|
nuclear@0
|
22
|
nuclear@0
|
23 vec3 diffuse = KD * gl_LightSource[0].diffuse.rgb * ndotl;
|
nuclear@2
|
24 vec3 specular = vec3(0.0, 0.0, 0.0);//KS * gl_LightSource[0].specular.rgb * pow(ndoth, SPOW);
|
nuclear@0
|
25
|
nuclear@0
|
26 vec3 ambient = gl_LightModel.ambient.rgb * KD;
|
nuclear@0
|
27 gl_FragColor.rgb = ambient + (diffuse + specular) * shadow;
|
nuclear@0
|
28 gl_FragColor.a = gl_FrontMaterial.diffuse.a;
|
nuclear@2
|
29 */
|
nuclear@2
|
30 gl_FragColor.rgb = n * 0.5 + 0.5;
|
nuclear@2
|
31 gl_FragColor.a = 1.0;
|
nuclear@0
|
32 }
|