Home | History | Annotate | Download | only in Shaders
      1 //
      2 //  ShaderPlain.fsh
      3 //
      4 
      5 uniform lowp vec3       vMaterialAmbient;
      6 uniform mediump vec4       vMaterialSpecular;
      7 
      8 varying lowp vec4 colorDiffuse;
      9 
     10 uniform highp vec3      vLight0;
     11 varying mediump vec3 position;
     12 varying mediump vec3 normal;
     13 
     14 void 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