VertShader.vsh 503 B

123456789101112131415161718192021
  1. attribute highp vec3 inVertex;
  2. attribute mediump vec3 inNormal;
  3. attribute mediump vec2 inTexCoord;
  4. uniform highp mat4 MVPMatrix;
  5. uniform mediump vec3 LightDirection;
  6. varying lowp float LightIntensity;
  7. varying mediump vec2 TexCoord;
  8. void main()
  9. {
  10. // Transform position
  11. gl_Position = MVPMatrix * vec4(inVertex, 1.0);
  12. // Pass through texcoords
  13. TexCoord = inTexCoord;
  14. // Simple diffuse lighting in model space
  15. LightIntensity = dot(inNormal, -LightDirection);
  16. }