VertShader.vsh 588 B

1234567891011121314151617181920212223
  1. attribute highp vec4 inVertex;
  2. attribute highp vec3 inNormal;
  3. attribute highp vec2 inTexCoord;
  4. uniform highp mat4 MVPMatrix;
  5. uniform highp vec3 LightDirection;
  6. uniform highp float MaterialBias;
  7. uniform highp float MaterialScale;
  8. varying lowp vec3 DiffuseLight;
  9. varying lowp vec3 SpecularLight;
  10. varying mediump vec2 TexCoord;
  11. void main()
  12. {
  13. gl_Position = MVPMatrix * inVertex;
  14. DiffuseLight = vec3(max(dot(inNormal, LightDirection), 0.0));
  15. SpecularLight = vec3(max((DiffuseLight.x - MaterialBias) * MaterialScale, 0.0));
  16. TexCoord = inTexCoord;
  17. }