wboit-params.glsl.ts 600 B

1234567891011121314151617181920
  1. export default `
  2. #if defined(dRenderVariant_colorWboit)
  3. #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)
  4. uniform sampler2D tDepth;
  5. uniform vec2 uDrawingBufferSize;
  6. float getDepth(const in vec2 coords) {
  7. // always packed due to merged depth from primitives and volumes
  8. return unpackRGBAToDepth(texture2D(tDepth, coords));
  9. }
  10. #endif
  11. #endif
  12. uniform int uRenderWboit;
  13. float calcDepth(const in vec3 pos) {
  14. vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;
  15. return 0.5 + 0.5 * clipZW.x / clipZW.y;
  16. }
  17. `;