Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CH11-bumpmap.vert.txt 816B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Vertex shader for procedural bumps
  3. //
  4. // Authors: Randi Rost, John Kessenich
  5. //
  6. // Copyright (c) 2002-2006 3Dlabs Inc. Ltd.
  7. //
  8. // See 3Dlabs-License.txt for license information
  9. //
  10. varying vec3 LightDir;
  11. varying vec3 EyeDir;
  12. uniform vec3 LightPosition;
  13. attribute vec3 Tangent;
  14. void main()
  15. {
  16. EyeDir = vec3(gl_ModelViewMatrix * gl_Vertex);
  17. gl_Position = ftransform();
  18. gl_TexCoord[0] = gl_MultiTexCoord0;
  19. vec3 n = normalize(gl_NormalMatrix * gl_Normal);
  20. vec3 t = normalize(gl_NormalMatrix * Tangent);
  21. vec3 b = cross(n, t);
  22. vec3 v;
  23. v.x = dot(LightPosition, t);
  24. v.y = dot(LightPosition, b);
  25. v.z = dot(LightPosition, n);
  26. LightDir = normalize(v);
  27. v.x = dot(EyeDir, t);
  28. v.y = dot(EyeDir, b);
  29. v.z = dot(EyeDir, n);
  30. EyeDir = normalize(v);
  31. }