tesspot
diff sdr/bezier.p.glsl @ 0:72b7f9f2eead
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Dec 2012 08:23:51 +0200 |
parents | |
children | 178a9e3c3c8c |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sdr/bezier.p.glsl Sun Dec 02 08:23:51 2012 +0200 1.3 @@ -0,0 +1,26 @@ 1.4 +#version 410 compatibility 1.5 + 1.6 +in vec3 normal; 1.7 +in vec3 vpos; 1.8 + 1.9 +void main() 1.10 +{ 1.11 + vec3 ldir = gl_LightSource[0].position.xyz - vpos; 1.12 + 1.13 + vec3 n = normalize(normal); 1.14 + vec3 v = -normalize(vpos); 1.15 + vec3 l = normalize(ldir); 1.16 + vec3 h = normalize(l + v); 1.17 + 1.18 + float ndotl = max(dot(n, l), 0.0); 1.19 + float ndoth = max(dot(n, h), 0.0); 1.20 + 1.21 + vec3 kd = gl_FrontMaterial.diffuse.xyz; 1.22 + vec3 ks = gl_FrontMaterial.specular.xyz; 1.23 + float shin = gl_FrontMaterial.shininess; 1.24 + 1.25 + vec3 diffuse = kd * ndotl * gl_LightSource[0].diffuse.xyz; 1.26 + vec3 specular = ks * pow(ndoth, shin) * gl_LightSource[0].specular.xyz; 1.27 + 1.28 + gl_FragColor = vec4(diffuse + specular, gl_FrontMaterial.diffuse.w); 1.29 +}