All files / engine/Source/Shaders/Builtin/Functions approximateSphericalCoordinates.js

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                                         
//This file is automatically rebuilt by the Cesium build process.
export default "/**\n\
 * Approximately computes spherical coordinates given a normal.\n\
 * Uses approximate inverse trigonometry for speed and consistency,\n\
 * since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.\n\
 *\n\
 * @name czm_approximateSphericalCoordinates\n\
 * @glslFunction\n\
 *\n\
 * @param {vec3} normal arbitrary-length normal.\n\
 *\n\
 * @returns {vec2} Approximate latitude and longitude spherical coordinates.\n\
 */\n\
vec2 czm_approximateSphericalCoordinates(vec3 normal) {\n\
    // Project into plane with vertical for latitude\n\
    float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\n\
    float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\n\
    return vec2(latitudeApproximation, longitudeApproximation);\n\
}\n\
";