wboit-params.glsl.ts 646 B

12345678910111213141516171819202122
  1. export default `
  2. #if defined(dRenderVariant_color)
  3. #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)
  4. uniform sampler2D tDepth;
  5. uniform vec2 uDrawingBufferSize;
  6. float getDepth(const in vec2 coords) {
  7. #ifdef dPackedDepth
  8. return unpackRGBAToDepth(texture2D(tDepth, coords));
  9. #else
  10. return texture2D(tDepth, coords).r;
  11. #endif
  12. }
  13. #endif
  14. uniform int uRenderWboit;
  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. `;