decompressTextureCoordinates.glsl 522 B

1234567891011121314151617
  1. /**
  2. * Decompresses texture coordinates that were packed into a single float.
  3. *
  4. * @name czm_decompressTextureCoordinates
  5. * @glslFunction
  6. *
  7. * @param {float} encoded The compressed texture coordinates.
  8. * @returns {vec2} The decompressed texture coordinates.
  9. */
  10. vec2 czm_decompressTextureCoordinates(float encoded)
  11. {
  12. float temp = encoded / 4096.0;
  13. float xZeroTo4095 = floor(temp);
  14. float stx = xZeroTo4095 / 4095.0;
  15. float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;
  16. return vec2(stx, sty);
  17. }