oculus1
diff sdr/phong.p.glsl @ 16:f3672317e5c2
made teapots many sizes and more colorful, added phong shader
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 21 Sep 2013 05:22:48 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sdr/phong.p.glsl Sat Sep 21 05:22:48 2013 +0300 1.3 @@ -0,0 +1,19 @@ 1.4 +varying vec3 vpos, norm, ldir; 1.5 + 1.6 +void main() 1.7 +{ 1.8 + vec3 v = -normalize(vpos); 1.9 + vec3 n = normalize(norm); 1.10 + vec3 l = normalize(ldir); 1.11 + vec3 h = normalize(v + l); 1.12 + 1.13 + float ndotl = max(dot(n, l), 0.0); 1.14 + float ndoth = max(dot(n, h), 0.0); 1.15 + 1.16 + vec3 diff = gl_FrontMaterial.diffuse.rgb * gl_LightSource[0].diffuse.rgb * ndotl; 1.17 + vec3 spec = gl_FrontMaterial.specular.rgb * gl_LightSource[0].specular.rgb * 1.18 + pow(ndoth, gl_FrontMaterial.shininess); 1.19 + 1.20 + gl_FragColor.rgb = diff + spec; 1.21 + gl_FragColor.a = 1.0; 1.22 +}