voxel_lighting.vs 611 B

12345678910111213141516171819202122232425262728
  1. #version 100
  2. precision mediump float;
  3. // Input vertex attributes
  4. attribute vec3 vertexPosition;
  5. attribute vec3 vertexNormal;
  6. attribute vec4 vertexColor;
  7. // attribute vec2 vertexTexCoord;
  8. // Input uniform values
  9. uniform mat4 mvp;
  10. uniform mat4 matModel;
  11. uniform mat4 matNormal;
  12. // Output to fragment shader
  13. varying vec3 fragPosition;
  14. varying vec4 fragColor;
  15. varying vec3 fragNormal;
  16. void main()
  17. {
  18. fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
  19. fragColor = vertexColor;
  20. fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
  21. gl_Position = mvp*vec4(vertexPosition, 1.0);
  22. }