writeNonPerspective.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Transforms a value for non-perspective interpolation by multiplying\n\
  4. * it by w, the value used in the perspective divide. This function is\n\
  5. * intended to be called in a vertex shader to compute the value of a\n\
  6. * `varying` that should not be subject to perspective interpolation.\n\
  7. * For example, screen-space texture coordinates. The fragment shader\n\
  8. * must call {@link czm_readNonPerspective} to retrieve the final\n\
  9. * non-perspective value.\n\
  10. *\n\
  11. * @name czm_writeNonPerspective\n\
  12. * @glslFunction\n\
  13. *\n\
  14. * @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective.\n\
  15. * @param {float} w The perspective divide value. Usually this is the computed `gl_Position.w`.\n\
  16. * @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a `varying` and read in the\n\
  17. * fragment shader with {@link czm_readNonPerspective}.\n\
  18. */\n\
  19. float czm_writeNonPerspective(float value, float w) {\n\
  20. return value * w;\n\
  21. }\n\
  22. \n\
  23. vec2 czm_writeNonPerspective(vec2 value, float w) {\n\
  24. return value * w;\n\
  25. }\n\
  26. \n\
  27. vec3 czm_writeNonPerspective(vec3 value, float w) {\n\
  28. return value * w;\n\
  29. }\n\
  30. \n\
  31. vec4 czm_writeNonPerspective(vec4 value, float w) {\n\
  32. return value * w;\n\
  33. }\n\
  34. ";