gradient.vertex.fx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. precision highp float;
  2. // Attributes
  3. attribute vec3 position;
  4. #ifdef NORMAL
  5. attribute vec3 normal;
  6. #endif
  7. #ifdef UV1
  8. attribute vec2 uv;
  9. #endif
  10. #ifdef UV2
  11. attribute vec2 uv2;
  12. #endif
  13. #ifdef VERTEXCOLOR
  14. attribute vec4 color;
  15. #endif
  16. #include<bonesDeclaration>
  17. // Uniforms
  18. #include<instancesDeclaration>
  19. uniform mat4 view;
  20. uniform mat4 viewProjection;
  21. #ifdef POINTSIZE
  22. uniform float pointSize;
  23. #endif
  24. // Output
  25. varying vec3 vPositionW;
  26. varying vec3 vPosition;
  27. #ifdef NORMAL
  28. varying vec3 vNormalW;
  29. #endif
  30. #ifdef VERTEXCOLOR
  31. varying vec4 vColor;
  32. #endif
  33. #include<clipPlaneVertexDeclaration>
  34. #include<fogVertexDeclaration>
  35. #include<__decl__lightFragment>[0..maxSimultaneousLights]
  36. void main(void) {
  37. #include<instancesVertex>
  38. #include<bonesVertex>
  39. vec4 worldPos = finalWorld * vec4(position, 1.0);
  40. gl_Position = viewProjection * worldPos;
  41. vPositionW = vec3(worldPos);
  42. vPosition = position;
  43. #ifdef NORMAL
  44. vNormalW = normalize(vec3(finalWorld * vec4(normal, 0.0)));
  45. #endif
  46. // Texture coordinates
  47. #ifndef UV1
  48. vec2 uv = vec2(0., 0.);
  49. #endif
  50. #ifndef UV2
  51. vec2 uv2 = vec2(0., 0.);
  52. #endif
  53. // Clip plane
  54. #include<clipPlaneVertex>
  55. // Fog
  56. #include<fogVertex>
  57. #include<shadowsVertex>[0..maxSimultaneousLights]
  58. // Vertex color
  59. #ifdef VERTEXCOLOR
  60. vColor = color;
  61. #endif
  62. // Point size
  63. #ifdef POINTSIZE
  64. gl_PointSize = pointSize;
  65. #endif
  66. }