Sha256: 1b1e324de911a4d0433925249c603fa3c855b9cfd71f9012cc7f74f35066ea8c

Contents?: true

Size: 1.67 KB

Versions: 12

Compression:

Stored size: 1.67 KB

Contents

/**
 * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system 
 * to eye coordinates.  In east-north-up coordinates, x points east, y points north, and z points along the 
 * surface normal.  East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.
 * <br /><br />
 * The ellipsoid is assumed to be centered at the model coordinate's origin.
 *
 * @name czm_eastNorthUpToEyeCoordinates
 * @glslFunction
 *
 * @param {vec3} positionMC The position on the ellipsoid in model coordinates.
 * @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.
 *
 * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.
 *
 * @example
 * // Transform a vector defined in the east-north-up coordinate 
 * // system, (0, 0, 1) which is the surface normal, to eye 
 * // coordinates.
 * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
 * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);
 */
mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
{
    vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0));  // normalized surface tangent in model coordinates
    vec3 tangentEC = normalize(czm_normal3D * tangentMC);                // normalized surface tangent in eye coordiantes
    vec3 bitangentEC = normalize(cross(normalEC, tangentEC));            // normalized surface bitangent in eye coordinates

    return mat3(
        tangentEC.x,   tangentEC.y,   tangentEC.z,
        bitangentEC.x, bitangentEC.y, bitangentEC.z,
        normalEC.x,    normalEC.y,    normalEC.z);
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cesium-1.24.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-1.23.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-1.18.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-1.17.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.25.0 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.24.1 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.24.0 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.23.0 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.22.0 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.21.1 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.21 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl
cesium-0.20.0 app/assets/javascripts/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.glsl