geometry.vertex.fx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. precision highp float;
  2. precision highp int;
  3. #include<bonesDeclaration>
  4. #include<instancesDeclaration>
  5. attribute vec3 position;
  6. attribute vec3 normal;
  7. #if defined(ALPHATEST) || defined(NEED_UV)
  8. varying vec2 vUV;
  9. uniform mat4 diffuseMatrix;
  10. #ifdef UV1
  11. varying vec2 uv;
  12. #endif
  13. #ifdef UV2
  14. varying vec2 uv2;
  15. #endif
  16. #endif
  17. // Uniform
  18. uniform mat4 viewProjection;
  19. uniform mat4 view;
  20. varying vec3 vNormalV;
  21. varying vec4 vViewPos;
  22. #ifdef POSITION
  23. varying vec3 vPosition;
  24. #endif
  25. void main(void)
  26. {
  27. #include<instancesVertex>
  28. #include<bonesVertex>
  29. vec4 pos = vec4(finalWorld * vec4(position, 1.0));
  30. vNormalV = normalize(vec3((view * finalWorld) * vec4(normal, 0.0)));
  31. vViewPos = view * pos;
  32. #ifdef POSITION
  33. vPosition = pos.xyz / pos.w;
  34. #endif
  35. gl_Position = viewProjection * finalWorld * vec4(position, 1.0);
  36. #if defined(ALPHATEST) || defined(BASIC_RENDER)
  37. #ifdef UV1
  38. vUV = vec2(diffuseMatrix * vec4(uv, 1.0, 0.0));
  39. #endif
  40. #ifdef UV2
  41. vUV = vec2(diffuseMatrix * vec4(uv2, 1.0, 0.0));
  42. #endif
  43. #endif
  44. }