VertShader.vsh 546 B

12345678910111213141516171819
  1. attribute highp vec3 inVertex;
  2. attribute mediump vec3 inNormal;
  3. uniform highp mat4 MVPMatrix; // model view projection transformation
  4. uniform highp vec3 LightDirection; // light direction in model space
  5. uniform highp vec3 EyePosition; // eye position in model space
  6. varying mediump vec2 TexCoord;
  7. void main()
  8. {
  9. gl_Position = MVPMatrix * vec4(inVertex,1.0);
  10. mediump vec3 eyeDirection = normalize(EyePosition - inVertex);
  11. TexCoord.x = dot(LightDirection, inNormal);
  12. TexCoord.y = dot(eyeDirection, inNormal);
  13. }