/extra/gpu/demos/bunny/bunny.v.glsl

http://github.com/abeaumont/factor · GLSL · 22 lines · 16 code · 6 blank · 0 comment · 0 complexity · d02422856b0661f59f5c3e68f4f561f9 MD5 · raw file

  1. #version 110
  2. uniform mat4 mv_matrix, p_matrix;
  3. uniform vec3 light_position;
  4. attribute vec3 vertex, normal;
  5. varying vec3 frag_normal;
  6. varying vec3 frag_light_direction;
  7. varying vec3 frag_eye_direction;
  8. void
  9. main()
  10. {
  11. vec4 position = mv_matrix * vec4(vertex, 1.0);
  12. gl_Position = p_matrix * position;
  13. frag_normal = (mv_matrix * vec4(normal, 0.0)).xyz;
  14. frag_light_direction = (mv_matrix * vec4(light_position, 1.0)).xyz - position.xyz;
  15. frag_eye_direction = position.xyz;
  16. }