12345678910111213141516171819202122232425 |
- /**
- * Creates a matrix that transforms vectors from tangent space to eye space.
- *
- * @name czm_tangentToEyeSpaceMatrix
- * @glslFunction
- *
- * @param {vec3} normalEC The normal vector in eye coordinates.
- * @param {vec3} tangentEC The tangent vector in eye coordinates.
- * @param {vec3} bitangentEC The bitangent vector in eye coordinates.
- *
- * @returns {mat3} The matrix that transforms from tangent space to eye space.
- *
- * @example
- * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);
- * vec3 normal = tangentToEye * texture(normalMap, st).xyz;
- */
- mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)
- {
- vec3 normal = normalize(normalEC);
- vec3 tangent = normalize(tangentEC);
- vec3 bitangent = normalize(bitangentEC);
- return mat3(tangent.x , tangent.y , tangent.z,
- bitangent.x, bitangent.y, bitangent.z,
- normal.x , normal.y , normal.z);
- }
|