fog-fs.chunk 628 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
  2. #include <legacy/fog-base>
  3. #if !CC_USE_ACCURATE_FOG
  4. in mediump float v_fog_factor;
  5. #endif
  6. #pragma define CC_FOG_FACTOR v_fog_factor
  7. // Just to be compatible with old projects only
  8. // Do not support accurate fog
  9. void CC_APPLY_FOG(inout vec4 color) {
  10. #if !CC_USE_ACCURATE_FOG
  11. CC_APPLY_FOG_BASE(color, CC_FOG_FACTOR);
  12. #endif
  13. }
  14. void CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {
  15. #if CC_USE_ACCURATE_FOG
  16. float factor;
  17. CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);
  18. #else
  19. float factor = CC_FOG_FACTOR;
  20. #endif
  21. CC_APPLY_FOG_BASE(color, factor);
  22. }