hue.js 591 B

12345678910111213141516
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "vec3 czm_hue(vec3 rgb, float adjustment)\n\
  3. {\n\
  4. const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n\
  5. 0.595716, -0.274453, -0.321263,\n\
  6. 0.211456, -0.522591, 0.311135);\n\
  7. const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n\
  8. 1.0, -0.2721, -0.6474,\n\
  9. 1.0, -1.107, 1.7046);\n\
  10. vec3 yiq = toYIQ * rgb;\n\
  11. float hue = atan(yiq.z, yiq.y) + adjustment;\n\
  12. float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n\
  13. vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n\
  14. return toRGB * color;\n\
  15. }\n\
  16. ";