fs.chunk 663 B

123456789101112131415161718192021222324
  1. in highp vec2 v_clip_depth;
  2. layout(location = 0) out vec4 fragColorX;
  3. void main () {
  4. // better performance than SurfacesFragmentModifyBaseColorAndTransparency
  5. #ifdef CC_SURFACES_FRAGMENT_ALPHA_CLIP_ONLY
  6. SurfacesFragmentAlphaClipOnly();
  7. #endif
  8. highp float clipDepth = v_clip_depth.x / v_clip_depth.y * 0.5 + 0.5;
  9. // spot use linear
  10. #if CC_SHADOWMAP_USE_LINEAR_DEPTH
  11. if (IS_SPOT_LIGHT(cc_shadowLPNNInfo.x)) {
  12. clipDepth = CCGetLinearDepth(FSInput_worldPos.xyz);
  13. }
  14. #endif
  15. #if CC_SHADOWMAP_FORMAT == SHADOWMAP_FORMAT_RGBA8
  16. fragColorX = packDepthToRGBA(clipDepth);
  17. #else
  18. fragColorX = vec4(clipDepth, 1.0, 1.0, 1.0);
  19. #endif
  20. }