shadowMapVertexMetric.js 970 B

123456789101112131415161718192021222324252627282930313233
  1. // Do not edit.
  2. import { ShaderStore } from "../../Engines/shaderStore.js";
  3. const name = "shadowMapVertexMetric";
  4. const shader = `#if SM_USEDISTANCE==1
  5. vPositionWSM=worldPos.xyz;
  6. #endif
  7. #if SM_DEPTHTEXTURE==1
  8. #ifdef IS_NDC_HALF_ZRANGE
  9. #define BIASFACTOR 0.5
  10. #else
  11. #define BIASFACTOR 1.0
  12. #endif
  13. #ifdef USE_REVERSE_DEPTHBUFFER
  14. gl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;
  15. #else
  16. gl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;
  17. #endif
  18. #endif
  19. #if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1
  20. zSM=gl_Position.z;gl_Position.z=0.0;
  21. #elif SM_USEDISTANCE==0
  22. #ifdef USE_REVERSE_DEPTHBUFFER
  23. vDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;
  24. #else
  25. vDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;
  26. #endif
  27. #endif
  28. `;
  29. // Sideeffect
  30. ShaderStore.IncludesShadersStore[name] = shader;
  31. /** @internal */
  32. export const shadowMapVertexMetric = { name, shader };
  33. //# sourceMappingURL=shadowMapVertexMetric.js.map