opengl_vertex.glsl 796 B

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