readNonPerspective.js 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Reads a value previously transformed with {@link czm_writeNonPerspective}\n\
  4. * by dividing it by `w`, the value used in the perspective divide.\n\
  5. * This function is intended to be called in a fragment shader to access a\n\
  6. * `varying` that should not be subject to perspective interpolation.\n\
  7. * For example, screen-space texture coordinates. The value should have been\n\
  8. * previously written in the vertex shader with a call to\n\
  9. * {@link czm_writeNonPerspective}.\n\
  10. *\n\
  11. * @name czm_readNonPerspective\n\
  12. * @glslFunction\n\
  13. *\n\
  14. * @param {float|vec2|vec3|vec4} value The non-perspective value to be read.\n\
  15. * @param {float} oneOverW One over the perspective divide value, `w`. Usually this is simply `gl_FragCoord.w`.\n\
  16. * @returns {float|vec2|vec3|vec4} The usable value.\n\
  17. */\n\
  18. float czm_readNonPerspective(float value, float oneOverW) {\n\
  19. return value * oneOverW;\n\
  20. }\n\
  21. \n\
  22. vec2 czm_readNonPerspective(vec2 value, float oneOverW) {\n\
  23. return value * oneOverW;\n\
  24. }\n\
  25. \n\
  26. vec3 czm_readNonPerspective(vec3 value, float oneOverW) {\n\
  27. return value * oneOverW;\n\
  28. }\n\
  29. \n\
  30. vec4 czm_readNonPerspective(vec4 value, float oneOverW) {\n\
  31. return value * oneOverW;\n\
  32. }\n\
  33. ";