1//
2//  ShaderPlain.fsh
3//
4
5uniform lowp vec3       vMaterialAmbient;
6uniform mediump vec4       vMaterialSpecular;
7
8varying lowp vec4 colorDiffuse;
9
10uniform highp vec3      vLight0;
11varying mediump vec3 position;
12varying mediump vec3 normal;
13
14void main()
15{
16    mediump vec3 halfVector = normalize(-vLight0 + position);
17    mediump float NdotH = max(dot(normalize(normal), halfVector), 0.0);
18    mediump float fPower = vMaterialSpecular.w;
19    mediump float specular = pow(NdotH, fPower);
20
21    lowp vec4 colorSpecular = vec4( vMaterialSpecular.xyz * specular, 1 );
22    gl_FragColor = colorDiffuse + colorSpecular;
23}
24