depth.vertex.fx 807 B

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