Shuvit game master repo. http://shuvit.org
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.

sky.vs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. attribute vec4 Tangent;
  2. varying vec4 fragPos;
  3. varying vec3 wT, wB, wN; //tangent binormal normal
  4. varying vec3 wPos, pos, viewPos, sunPos;
  5. //varying vec3 wPos, pos, viewPos;
  6. uniform mat4 ModelMatrix;
  7. uniform vec3 cameraPos;
  8. varying float luminance;
  9. varying vec3 sunPos4;
  10. uniform float sunx;
  11. uniform float suny;
  12. uniform float sunz;
  13. mat3 m3( mat4 m )
  14. {
  15. mat3 result;
  16. result[0][0] = m[0][0];
  17. result[0][1] = m[0][1];
  18. result[0][2] = m[0][2];
  19. result[1][0] = m[1][0];
  20. result[1][1] = m[1][1];
  21. result[1][2] = m[1][2];
  22. result[2][0] = m[2][0];
  23. result[2][1] = m[2][1];
  24. result[2][2] = m[2][2];
  25. return result;
  26. }
  27. void main()
  28. {
  29. wPos = vec3(ModelMatrix * gl_Vertex);
  30. wT = m3(ModelMatrix)*Tangent.xyz;
  31. wB = m3(ModelMatrix)*cross(gl_Normal, Tangent.xyz);
  32. wN = m3(ModelMatrix)*gl_Normal;
  33. //fragPos = ftransform();
  34. viewPos = wPos - cameraPos.xyz;
  35. //sunPos = m3(ModelMatrix)*vec3(gl_ModelViewMatrixInverse*gl_LightSource[0].position);
  36. sunPos = vec3(sunx, suny, sunz);
  37. //luminance = 10000.000003
  38. luminance = gl_Color.r;
  39. gl_Position = ftransform();
  40. }