2
0

opengl_vertex.glsl 684 B

1234567891011121314151617181920212223242526272829303132
  1. uniform mat4 mWorldViewProj;
  2. uniform mat4 mWorld;
  3. uniform vec3 eyePosition;
  4. uniform float animationTimer;
  5. varying vec3 vPosition;
  6. varying vec3 worldPosition;
  7. varying vec3 eyeVec;
  8. varying vec3 lightVec;
  9. varying vec3 tsEyeVec;
  10. varying vec3 tsLightVec;
  11. const float e = 2.718281828459;
  12. const float BS = 10.0;
  13. void main(void)
  14. {
  15. gl_TexCoord[0] = gl_MultiTexCoord0;
  16. gl_Position = mWorldViewProj * gl_Vertex;
  17. vPosition = gl_Position.xyz;
  18. worldPosition = (mWorld * gl_Vertex).xyz;
  19. vec3 sunPosition = vec3 (0.0, eyePosition.y * BS + 900.0, 0.0);
  20. lightVec = sunPosition - worldPosition;
  21. eyeVec = -(gl_ModelViewMatrix * gl_Vertex).xyz;
  22. gl_FrontColor = gl_BackColor = gl_Color;
  23. }