BaseVertShader.vsh 620 B

123456789101112131415161718192021222324252627
  1. /*
  2. Simple vertex shader:
  3. - standard vertex transformation
  4. - diffuse lighting for one directional light
  5. - texcoord passthrough
  6. */
  7. attribute highp vec3 inVertex;
  8. attribute mediump vec3 inNormal;
  9. attribute mediump vec2 inTexCoord;
  10. uniform highp mat4 MVPMatrix;
  11. uniform mediump vec3 LightPosModel;
  12. varying lowp float LightIntensity;
  13. varying mediump vec2 TexCoord;
  14. void main()
  15. {
  16. gl_Position = MVPMatrix * vec4(inVertex, 1.0);
  17. mediump vec3 lightDir = normalize(LightPosModel - inVertex);
  18. LightIntensity = max(0.0, dot(inNormal, lightDir));
  19. TexCoord = inTexCoord;
  20. }