All files / engine/Source/Shaders/Voxels IntersectDepth.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 22 23 24 25 26 27 28 29 30                                                           
//This file is automatically rebuilt by the Cesium build process.
export default "// See IntersectionUtils.glsl for the definitions of Ray, Intersections,\n\
// setIntersectionPair, INF_HIT, NO_HIT\n\
\n\
/* intersectDepth defines (set in Scene/VoxelRenderResources.js)\n\
#define DEPTH_INTERSECTION_INDEX ###\n\
*/\n\
\n\
void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {\n\
    float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));\n\
    float entry;\n\
    float exit;\n\
    if (logDepthOrDepth != 0.0) {\n\
        // Calculate how far the ray must travel before it hits the depth buffer.\n\
        vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);\n\
        eyeCoordinateDepth /= eyeCoordinateDepth.w;\n\
        entry = dot(eyeCoordinateDepth.xyz - ray.pos, ray.dir);\n\
        exit = +INF_HIT;\n\
    } else {\n\
        // There's no depth at this location.\n\
        entry = NO_HIT;\n\
        exit = NO_HIT;\n\
    }\n\
    ix.distanceToDepthBuffer = entry;\n\
#if defined(DEPTH_TEST)\n\
    setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(entry, exit));\n\
#endif\n\
}\n\
";