tangentToEyeSpaceMatrix.js 1.1 KB

123456789101112131415161718192021222324252627
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Creates a matrix that transforms vectors from tangent space to eye space.\n\
  4. *\n\
  5. * @name czm_tangentToEyeSpaceMatrix\n\
  6. * @glslFunction\n\
  7. *\n\
  8. * @param {vec3} normalEC The normal vector in eye coordinates.\n\
  9. * @param {vec3} tangentEC The tangent vector in eye coordinates.\n\
  10. * @param {vec3} bitangentEC The bitangent vector in eye coordinates.\n\
  11. *\n\
  12. * @returns {mat3} The matrix that transforms from tangent space to eye space.\n\
  13. *\n\
  14. * @example\n\
  15. * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);\n\
  16. * vec3 normal = tangentToEye * texture(normalMap, st).xyz;\n\
  17. */\n\
  18. mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n\
  19. {\n\
  20. vec3 normal = normalize(normalEC);\n\
  21. vec3 tangent = normalize(tangentEC);\n\
  22. vec3 bitangent = normalize(bitangentEC);\n\
  23. return mat3(tangent.x , tangent.y , tangent.z,\n\
  24. bitangent.x, bitangent.y, bitangent.z,\n\
  25. normal.x , normal.y , normal.z);\n\
  26. }\n\
  27. ";