nuclear@7: varying vec3 normal, vpos; nuclear@7: nuclear@7: void main() nuclear@7: { nuclear@7: vec3 n = normalize(normal); nuclear@7: vec3 v = -normalize(vpos); nuclear@7: nuclear@8: vec3 color = vec3(0.0, 0.0, 0.0); nuclear@7: nuclear@8: for(int i=0; i<2; i++) { nuclear@8: vec3 l = normalize(gl_LightSource[i].position.xyz); nuclear@8: vec3 h = normalize(v + l); nuclear@8: nuclear@8: float ndotl = max(dot(n, l), 0.0); nuclear@8: float ndoth = max(dot(n, h), 0.0); nuclear@8: float spec = pow(ndoth, gl_FrontMaterial.shininess); nuclear@8: nuclear@8: vec3 dcol = gl_FrontMaterial.diffuse.xyz * gl_LightSource[i].diffuse.xyz; nuclear@8: vec3 scol = gl_FrontMaterial.specular.xyz * gl_LightSource[i].diffuse.xyz; nuclear@8: nuclear@8: color += dcol * ndotl + scol * spec; nuclear@8: } nuclear@7: nuclear@7: vec3 acol = gl_FrontMaterial.ambient.xyz * gl_LightModel.ambient.xyz; nuclear@7: nuclear@8: gl_FragColor.xyz = acol + color; nuclear@7: gl_FragColor.w = 1.0; nuclear@7: }