depth_pack.glslf 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #version GLSL_VERSION
  2. /*==============================================================================
  3. VARS
  4. ==============================================================================*/
  5. #var PRECISION highp
  6. /*============================================================================*/
  7. precision PRECISION sampler2D;
  8. #include <precision_statement.glslf>
  9. #include <std.glsl>
  10. #include <pack.glslf>
  11. #include <depth_fetch.glslf>
  12. uniform sampler2D u_depth;
  13. uniform vec2 u_camera_range;
  14. /*==============================================================================
  15. SHADER INTERFACE
  16. ==============================================================================*/
  17. GLSL_IN vec2 v_texcoord;
  18. //------------------------------------------------------------------------------
  19. GLSL_OUT vec4 GLSL_OUT_FRAG_COLOR;
  20. /*==============================================================================
  21. MAIN
  22. ==============================================================================*/
  23. void main(void) {
  24. GLSL_OUT_FRAG_COLOR = pack(clamp(depth_fetch(u_depth, v_texcoord,
  25. u_camera_range), 0.0, 0.999999));
  26. }