shadowMap.vertex.fx 887 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Attribute
  2. attribute vec3 position;
  3. #include<bonesDeclaration>
  4. // Uniforms
  5. #include<instancesDeclaration>
  6. uniform mat4 viewProjection;
  7. uniform vec2 biasAndScale;
  8. uniform vec2 depthValues;
  9. varying float vDepthMetric;
  10. #ifdef ALPHATEST
  11. varying vec2 vUV;
  12. uniform mat4 diffuseMatrix;
  13. #ifdef UV1
  14. attribute vec2 uv;
  15. #endif
  16. #ifdef UV2
  17. attribute vec2 uv2;
  18. #endif
  19. #endif
  20. void main(void)
  21. {
  22. #include<instancesVertex>
  23. #include<bonesVertex>
  24. vec4 worldPos = finalWorld * vec4(position, 1.0);
  25. gl_Position = viewProjection * worldPos;
  26. vDepthMetric = ((gl_Position.z + depthValues.x) / (depthValues.y)) + biasAndScale.x;
  27. gl_Position.z = vDepthMetric;
  28. // gl_Position.w = 1.0;
  29. #ifdef ALPHATEST
  30. #ifdef UV1
  31. vUV = vec2(diffuseMatrix * vec4(uv, 1.0, 0.0));
  32. #endif
  33. #ifdef UV2
  34. vUV = vec2(diffuseMatrix * vec4(uv2, 1.0, 0.0));
  35. #endif
  36. #endif
  37. }