wboit-params.glsl.ts 633 B

12345678910111213141516171819202122
  1. export default `
  2. #if defined(dRenderVariant_color)
  3. #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)
  4. uniform sampler2D tDepth;
  5. float getDepth(const in vec2 coords) {
  6. #ifdef dPackedDepth
  7. return unpackRGBAToDepth(texture2D(tDepth, coords));
  8. #else
  9. return texture2D(tDepth, coords).r;
  10. #endif
  11. }
  12. #endif
  13. uniform int uRenderWboit;
  14. uniform vec4 uViewport;
  15. #endif
  16. float calcDepth(const in vec3 pos) {
  17. vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;
  18. return 0.5 + 0.5 * clipZW.x / clipZW.y;
  19. }
  20. `;